物管理前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

5247 lines
1016 KiB

  1. import{a6 as Ht,aa as mo,p as PR,d as LR,Y as wR,t as FR,Q as BR,o as DR,b as UR}from"./index-bVOhw2NF.js";import{e as Bn,E as lp}from"./index-Cy9UOSCT.js";import{f as E,_ as kR,d as ly,e as cy,c as $R,b as zR,a as VR,g as bl}from"./defineProperty-DTM21if9.js";import{c as HR}from"./cloneDeep-C6NKQlMO.js";import"./typeof-QjJsDpFa.js";import"./_initCloneObject-K-Y0ueWp.js";import"./_getTag-BJ2nhJXz.js";var fy={},hy={},Jv=e=>hy[e],Tn=(e,t)=>{hy[e]=t},jR=e=>fy[e],ja=(e,t)=>{fy[e]=t},e0={},yh={},Th=34,Ss=10,Ah=13;function dy(e){return new Function("d","return {"+e.map(function(t,r){return JSON.stringify(t)+": d["+r+'] || ""'}).join(",")+"}")}function XR(e,t){var r=dy(e);return function(n,i){return t(r(n),i,e)}}function t0(e){var t=Object.create(null),r=[];return e.forEach(function(n){for(var i in n)i in t||r.push(t[i]=i)}),r}function un(e,t){var r=e+"",n=r.length;return n<t?new Array(t-n+1).join(0)+r:r}function WR(e){return e<0?"-"+un(-e,6):e>9999?"+"+un(e,6):un(e,4)}function GR(e){var t=e.getUTCHours(),r=e.getUTCMinutes(),n=e.getUTCSeconds(),i=e.getUTCMilliseconds();return isNaN(e)?"Invalid Date":WR(e.getUTCFullYear())+"-"+un(e.getUTCMonth()+1,2)+"-"+un(e.getUTCDate(),2)+(i?"T"+un(t,2)+":"+un(r,2)+":"+un(n,2)+"."+un(i,3)+"Z":n?"T"+un(t,2)+":"+un(r,2)+":"+un(n,2)+"Z":r||t?"T"+un(t,2)+":"+un(r,2)+"Z":"")}function YR(e){var t=new RegExp('["'+e+`
  2. \r]`),r=e.charCodeAt(0);function n(c,h){var d,p,v=i(c,function(g,y){if(d)return d(g,y-1);p=g,d=h?XR(g,h):dy(g)});return v.columns=p||[],v}function i(c,h){var d=[],p=c.length,v=0,g=0,y,S=p<=0,R=!1;c.charCodeAt(p-1)===Ss&&--p,c.charCodeAt(p-1)===Ah&&--p;function x(){if(S)return yh;if(R)return R=!1,e0;var $,F=v,Y;if(c.charCodeAt(F)===Th){for(;v++<p&&c.charCodeAt(v)!==Th||c.charCodeAt(++v)===Th;);return($=v)>=p?S=!0:(Y=c.charCodeAt(v++))===Ss?R=!0:Y===Ah&&(R=!0,c.charCodeAt(v)===Ss&&++v),c.slice(F+1,$-1).replace(/""/g,'"')}for(;v<p;){if((Y=c.charCodeAt($=v++))===Ss)R=!0;else if(Y===Ah)R=!0,c.charCodeAt(v)===Ss&&++v;else if(Y!==r)continue;return c.slice(F,$)}return S=!0,c.slice(F,p)}for(;(y=x())!==yh;){for(var M=[];y!==e0&&y!==yh;)M.push(y),y=x();h&&(M=h(M,g++))==null||d.push(M)}return d}function o(c,h){return c.map(function(d){return h.map(function(p){return f(d[p])}).join(e)})}function a(c,h){return h==null&&(h=t0(c)),[h.map(f).join(e)].concat(o(c,h)).join(`
  3. `)}function s(c,h){return h==null&&(h=t0(c)),o(c,h).join(`
  4. `)}function u(c){return c.map(l).join(`
  5. `)}function l(c){return c.map(f).join(e)}function f(c){return c==null?"":c instanceof Date?GR(c):t.test(c+="")?'"'+c.replace(/"/g,'""')+'"':c}return{parse:n,parseRows:i,format:a,formatBody:s,formatRows:u,formatRow:l,formatValue:f}}var ZR=YR(","),qR=ZR.parse;function cu(e,t,r){r===void 0&&(r={});var n={type:"Feature"};return(r.id===0||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=t||{},n.geometry=e,n}function cp(e,t,r){r===void 0&&(r={});for(var n=0,i=e;n<i.length;n++){var o=i[n];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var a=0;a<o[o.length-1].length;a++)if(o[o.length-1][a]!==o[0][a])throw new Error("First and last Position are not equivalent.")}var s={type:"Polygon",coordinates:e};return cu(s,t,r)}function KR(e,t,r){if(r===void 0&&(r={}),e.length<2)throw new Error("coordinates must be an array of two or more positions");var n={type:"LineString",coordinates:e};return cu(n,t,r)}function QR(e,t){t===void 0&&(t={});var r={type:"FeatureCollection"};return t.id&&(r.id=t.id),t.bbox&&(r.bbox=t.bbox),r.features=e,r}function JR(e,t,r){r===void 0&&(r={});var n={type:"MultiPolygon",coordinates:e};return cu(n,t,r)}function py(e){if(Array.isArray(e))return e;if(e.type==="Feature"){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function r0(e){return e.type==="Feature"?e.geometry:e}function _y(e,t,r){if(e!==null)for(var n,i,o,a,s,u,l,f=0,c=0,h,d=e.type,p=d==="FeatureCollection",v=d==="Feature",g=p?e.features.length:1,y=0;y<g;y++){l=p?e.features[y].geometry:v?e.geometry:e,h=l?l.type==="GeometryCollection":!1,s=h?l.geometries.length:1;for(var S=0;S<s;S++){var R=0,x=0;if(a=h?l.geometries[S]:l,a!==null){u=a.coordinates;var M=a.type;switch(f=0,M){case null:break;case"Point":if(t(u,c,y,R,x)===!1)return!1;c++,R++;break;case"LineString":case"MultiPoint":for(n=0;n<u.length;n++){if(t(u[n],c,y,R,x)===!1)return!1;c++,M==="MultiPoint"&&R++}M==="LineString"&&R++;break;case"Polygon":case"MultiLineString":for(n=0;n<u.length;n++){for(i=0;i<u[n].length-f;i++){if(t(u[n][i],c,y,R,x)===!1)return!1;c++}M==="MultiLineString"&&R++,M==="Polygon"&&x++}M==="Polygon"&&R++;break;case"MultiPolygon":for(n=0;n<u.length;n++){for(x=0,i=0;i<u[n].length;i++){for(o=0;o<u[n][i].length-f;o++){if(t(u[n][i][o],c,y,R,x)===!1)return!1;c++}x++}R++}break;case"GeometryCollection":for(n=0;n<a.geometries.length;n++)if(_y(a.geometries[n],t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function e2(e,t){var r,n,i,o,a,s,u,l,f,c,h=0,d=e.type==="FeatureCollection",p=e.type==="Feature",v=d?e.features.length:1;for(r=0;r<v;r++){for(s=d?e.features[r].geometry:p?e.geometry:e,l=d?e.features[r].properties:p?e.properties:{},f=d?e.features[r].bbox:p?e.bbox:void 0,c=d?e.features[r].id:p?e.id:void 0,u=s?s.type==="GeometryCollection":!1,a=u?s.geometries.length:1,i=0;i<a;i++){if(o=u?s.geometries[i]:s,o===null){if(t(null,h,l,f,c)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(o,h,l,f,c)===!1)return!1;break}case"GeometryCollection":{for(n=0;n<o.geometries.length;n++)if(t(o.geometries[n],h,l,f,c)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}h++}}function vy(e,t){e2(e,function(r,n,i,o,a){var s=r===null?null:r.type;switch(s){case null:case"Point":case"LineString":case"Polygon":return t(cu(r,i,{bbox:o,id:a}),n,0)===!1?!1:void 0}var u;switch(s){case"MultiPoint":u="Point";break;case"MultiLineString":u="LineString";break;case"MultiPolygon":u="Polygon";break}for(var l=0;l<r.coordinates.length;l++){var f=r.coordinates[l],c={type:u,coordinates:f};if(t(cu(c,i),n,l)===!1)return!1}})}var Gl={REGISTERED_PROTOCOLS:{}},t2=Object.defineProperty,r2=Object.defineProperties,n2=Object.getOwnPropertyDescriptors,n0=Object.getOwnPropertySymbols,i2=Object.prototype.hasOwnProperty,o2=Object.prototype.propertyIsEnumerable,i0=(e,t,r)=>t in e?t2(e,t,{enumerable:!0,configurable:!0,writable:!0,val
  6. ${this.key}
  7. `}})}get key(){return`${this.x}_${this.y}_${this.z}`}layerLoad(){this.loadedLayers++,this.emit("layerLoaded")}loadData(e){return bU(this,arguments,function*({getData:t,onLoad:r,onError:n}){this.loadDataId++;const i=this.loadDataId;this.isLoading&&this.abortLoad(),this.abortController=new AbortController,this.loadStatus=On.Loading;let o=null,a;try{const{x:s,y:u,z:l,bounds:f,tileSize:c,warp:h}=this,{warpX:d,warpY:p}=xU(s,u,l,h),{signal:v}=this.abortController;o=yield t({x:d,y:p,z:l,bounds:f,tileSize:c,signal:v,warp:h},this)}catch(s){a=s}if(i===this.loadDataId&&!(this.isCancelled&&!o)){if(a||!o){this.loadStatus=On.Failure,n(a,this);return}this.loadStatus=On.Loaded,this.data=o,r(this)}})}reloadData(e){this.isLoading&&this.abortLoad(),this.loadData(e)}abortLoad(){this.isLoaded||this.isCancelled||(this.loadStatus=On.Cancelled,this.abortController.abort(),this.xhrCancel&&this.xhrCancel())}},CU=(e,t)=>{const r=dc(e),n=Lp(r,t),i=360*3-180,o=85.0511287798065;return[Math.max(n[0][0],-i),Math.max(n[0][1],-o),Math.min(n[1][0],i),Math.min(n[1][1],o)]},OU=(e,t)=>{const r=dc(e),n=dc(t);return kT(r,n)},IU=Object.defineProperty,MU=Object.defineProperties,NU=Object.getOwnPropertyDescriptors,_m=Object.getOwnPropertySymbols,PU=Object.prototype.hasOwnProperty,LU=Object.prototype.propertyIsEnumerable,vm=(e,t,r)=>t in e?IU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,mm=(e,t)=>{for(var r in t||(t={}))PU.call(t,r)&&vm(e,r,t[r]);if(_m)for(var r of _m(t))LU.call(t,r)&&vm(e,r,t[r]);return e},wU=(e,t)=>MU(e,NU(t)),{throttle:FU}=Sr,BU=class extends lp{constructor(e){super(),this.currentTiles=[],this.cacheTiles=new Map,this.throttleUpdate=FU((t,r)=>{this.update(t,r)},16),this.onTileLoad=t=>{this.emit("tile-loaded",t),this.updateTileVisible(),this.loadFinished()},this.onTileError=(t,r)=>{this.emit("tile-error",{error:t,tile:r}),this.updateTileVisible(),this.loadFinished()},this.onTileUnload=t=>{this.emit("tile-unload",t),this.loadFinished()},this.options={tileSize:256,minZoom:0,maxZoom:1/0,zoomOffset:0,extent:XT,getTileData:AU,warp:!0,updateStrategy:ou.Replace},this.updateOptions(e)}get isLoaded(){return this.currentTiles.every(e=>e.isDone)}get tiles(){return Array.from(this.cacheTiles.values()).sort((t,r)=>t.z-r.z)}updateOptions(e){const t=e.minZoom===void 0?this.options.minZoom:Math.ceil(e.minZoom),r=e.maxZoom===void 0?this.options.maxZoom:Math.floor(e.maxZoom);this.options=wU(mm(mm({},this.options),e),{minZoom:t,maxZoom:r})}update(e,t){const r=Math.max(0,Math.ceil(e));if(this.lastViewStates&&this.lastViewStates.zoom===r&&OU(this.lastViewStates.latLonBoundsBuffer,t))return;const n=CU(t,EU);this.lastViewStates={zoom:r,latLonBounds:t,latLonBoundsBuffer:n},this.currentZoom=r;let i=!1;const o=this.getTileIndices(r,n).filter(a=>this.options.warp||a.x>=0&&a.x<Math.pow(2,r));this.emit("tiles-load-start"),this.currentTiles=o.map(({x:a,y:s,z:u})=>{let l=this.getTile(a,s,u);return l?(((l==null?void 0:l.isFailure)||(l==null?void 0:l.isCancelled))&&l.loadData({getData:this.options.getTileData,onLoad:this.onTileLoad,onError:this.onTileError}),l):(l=this.createTile(a,s,u),i=!0,l)}),i&&this.resizeCacheTiles(),this.updateTileVisible(),this.pruneRequests()}reloadAll(){for(const[e,t]of this.cacheTiles){if(!this.currentTiles.includes(t)){this.cacheTiles.delete(e),this.onTileUnload(t);return}this.onTileUnload(t),t.loadData({getData:this.options.getTileData,onLoad:this.onTileLoad,onError:this.onTileError})}}reloadTileById(e,t,r){const n=this.cacheTiles.get(`${t},${r},${e}`);n&&(this.onTileUnload(n),n.loadData({getData:this.options.getTileData,onLoad:this.onTileLoad,onError:this.onTileError}))}reloadTileByLnglat(e,t,r){const n=this.getTileByLngLat(e,t,r);n&&this.reloadTileById(n.z,n.x,n.y)}reloadTileByExtent(e,t){this.getTileIndices(t,e).forEach(n=>{this.reloadTileById(n.z,n.x,n.y)})}pruneRequests(){const e=[];for(const t of this.cacheTiles.values())t.isLoading&&!t.isCurrent&&!t.isVisible&&e.push(t);for(;e.length>0;)e.shift().abortLoad()}getTileByLngLat(e,t,r){const{zoomOffset:n}=this.options,i=Math.ceil(r)+n,o=gd(e,t,i);return this.tiles.filter(
  8. varying vec2 v_UV;
  9. void main() {
  10. v_UV = 0.5 * (a_Position + 1.0);
  11. gl_Position = vec4(a_Position, 0., 1.);
  12. }`,{camelCase:t9,isNil:r9,upperFirst:n9}=Sr;class Ai{constructor(){E(this,"shaderModuleService",void 0),E(this,"rendererService",void 0),E(this,"config",void 0),E(this,"quad",e9),E(this,"enabled",!0),E(this,"renderToScreen",!1),E(this,"model",void 0),E(this,"name",void 0),E(this,"optionsToUpdate",{})}getName(){return this.name}setName(t){this.name=t}getType(){return Fu.PostProcessing}init(t,r){this.config=r,this.rendererService=t.getContainer().rendererService,this.shaderModuleService=t.getContainer().shaderModuleService;const{createAttribute:n,createBuffer:i,createModel:o}=this.rendererService,{vs:a,fs:s,uniforms:u}=this.setupShaders();this.model=o({vs:a,fs:s,attributes:{a_Position:n({buffer:i({data:[-4,-4,4,-4,0,4],type:m.FLOAT}),size:2})},uniforms:he(he({u_Texture:null},u),this.config&&this.convertOptionsToUniforms(this.config)),depth:{enable:!1},count:3,blend:{enable:this.getName()==="copy"}})}render(t,r){const n=t.multiPassRenderer.getPostProcessor(),{useFramebuffer:i,getViewportSize:o,clear:a}=this.rendererService,{width:s,height:u}=o();i(this.renderToScreen?null:n.getWriteFBO(),()=>{a({framebuffer:n.getWriteFBO(),color:[0,0,0,0],depth:1,stencil:0});const l=he({u_BloomFinal:0,u_Texture:n.getReadFBO(),u_ViewportSize:[s,u]},this.convertOptionsToUniforms(this.optionsToUpdate));r&&(l.u_BloomFinal=1,l.u_Texture2=r),this.model.draw({uniforms:l})})}isEnabled(){return this.enabled}setEnabled(t){this.enabled=t}setRenderToScreen(t){this.renderToScreen=t}updateOptions(t){this.optionsToUpdate=he(he({},this.optionsToUpdate),t)}setupShaders(){throw new Error("Method not implemented.")}convertOptionsToUniforms(t){const r={};return Object.keys(t).forEach(n=>{r9(t[n])||(r[`u_${n9(t9(n))}`]=t[n])}),r}}function i9(e){let t=0;switch(e){case"vec2":case"ivec2":t=2;break;case"vec3":case"ivec3":t=3;break;case"vec4":case"ivec4":case"mat2":t=4;break;case"mat3":t=9;break;case"mat4":t=16;break}return t}const sA=/uniform\s+(bool|float|int|vec2|vec3|vec4|ivec2|ivec3|ivec4|mat2|mat3|mat4|sampler2D|samplerCube)\s+([\s\S]*?);/g;function Km(e,t=!1){const r={};return e=e.replace(sA,(n,i,o)=>{const a=o.split(":"),s=a[0].trim();let u="";switch(a.length>1&&(u=a[1].trim()),i){case"bool":u=u==="true";break;case"float":case"int":u=Number(u);break;case"vec2":case"vec3":case"vec4":case"ivec2":case"ivec3":case"ivec4":case"mat2":case"mat3":case"mat4":u?u=u.replace("[","").replace("]","").split(",").reduce((l,f)=>(l.push(Number(f.trim())),l),[]):u=new Array(i9(i)).fill(0);break}return r[s]=u,`${t?"uniform ":""}${i} ${s};
  13. `}),{content:e,uniforms:r}}function kh(e){let{content:t,uniforms:r}=Km(e,!0);return t=t.replace(/(\s*uniform\s*.*\s*){((?:\s*.*\s*)*?)};/g,(n,i,o)=>{o=o.trim().replace(/^.*$/gm,u=>`uniform ${u}`);const{content:a,uniforms:s}=Km(o);return Object.assign(r,s),`${i}{
  14. ${a}
  15. };`}),{content:t,uniforms:r}}function Qm(e){const t={};return e.replace(sA,(r,n,i)=>{const o=i.trim();return t[o]?"":(t[o]=!0,`uniform ${n} ${o};
  16. `)})}const fo={ProjectionMatrix:"u_ProjectionMatrix",ViewMatrix:"u_ViewMatrix",ViewProjectionMatrix:"u_ViewProjectionMatrix",Zoom:"u_Zoom",ZoomScale:"u_ZoomScale",FocalDistance:"u_FocalDistance",CameraPosition:"u_CameraPosition"};let _c=function(e){return e.TOPRIGHT="topright",e.TOPLEFT="topleft",e.BOTTOMRIGHT="bottomright",e.BOTTOMLEFT="bottomleft",e.TOPCENTER="topcenter",e.BOTTOMCENTER="bottomcenter",e.LEFTCENTER="leftcenter",e.RIGHTCENTER="rightcenter",e.LEFTTOP="lefttop",e.RIGHTTOP="righttop",e.LEFTBOTTOM="leftbottom",e.RIGHTBOTTOM="rightbottom",e}({}),vc=function(e){return e[e.LNGLAT=1]="LNGLAT",e[e.LNGLAT_OFFSET=2]="LNGLAT_OFFSET",e[e.VECTOR_TILE=3]="VECTOR_TILE",e[e.IDENTITY=4]="IDENTITY",e[e.METER_OFFSET=5]="METER_OFFSET",e}({});const ua={CoordinateSystem:"u_CoordinateSystem",ViewportCenter:"u_ViewportCenter",ViewportCenterProjection:"u_ViewportCenterProjection",PixelsPerDegree:"u_PixelsPerDegree",PixelsPerDegree2:"u_PixelsPerDegree2",PixelsPerMeter:"u_PixelsPerMeter"};var Fr={MapInitStart:"mapInitStart",LayerInitStart:"layerInitStart",LayerInitEnd:"layerInitEnd",SourceInitStart:"sourceInitStart",SourceInitEnd:"sourceInitEnd",ScaleInitStart:"scaleInitStart",ScaleInitEnd:"scaleInitEnd",MappingStart:"mappingStart",MappingEnd:"mappingEnd",BuildModelStart:"buildModelStart",BuildModelEnd:"buildModelEnd"};let cn=function(e){return e.Hover="hover",e.Click="click",e.Select="select",e.Active="active",e.Drag="drag",e}({}),Ui=function(e){return e.normal="normal",e.additive="additive",e.subtractive="subtractive",e.min="min",e.max="max",e.none="none",e}({}),go=function(e){return e.MULTIPLE="MULTIPLE",e.SINGLE="SINGLE",e}({}),uf=function(e){return e.AND="and",e.OR="or",e}({}),jr=function(e){return e.INIT="init",e.UPDATE="update",e}({}),Xt=function(e){return e.LINEAR="linear",e.SEQUENTIAL="sequential",e.POWER="power",e.LOG="log",e.IDENTITY="identity",e.TIME="time",e.QUANTILE="quantile",e.QUANTIZE="quantize",e.THRESHOLD="threshold",e.CAT="cat",e.DIVERGING="diverging",e.CUSTOM="threshold",e}({}),la=function(e){return e.CONSTANT="constant",e.VARIABLE="variable",e}({}),qe=function(e){return e[e.Attribute=0]="Attribute",e[e.InstancedAttribute=1]="InstancedAttribute",e[e.Uniform=2]="Uniform",e}({});const Jm=["mapload","mapchange","mapAfterFrameChange"];var Dp={exports:{}};Dp.exports=Bu;Dp.exports.default=Bu;var Ca=1e20;function Bu(e,t,r,n,i,o){this.fontSize=e||24,this.buffer=t===void 0?3:t,this.cutoff=n||.25,this.fontFamily=i||"sans-serif",this.fontWeight=o||"normal",this.radius=r||8;var a=this.size=this.fontSize+this.buffer*2,s=a+this.buffer*2;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=a,this.ctx=this.canvas.getContext("2d"),this.ctx.font=this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textAlign="left",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(s*s),this.gridInner=new Float64Array(s*s),this.f=new Float64Array(s),this.z=new Float64Array(s+1),this.v=new Uint16Array(s),this.useMetrics=this.ctx.measureText("A").actualBoundingBoxLeft!==void 0,this.middle=Math.round(a/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function o9(e,t,r,n,i,o,a){o.fill(Ca,0,t*r),a.fill(0,0,t*r);for(var s=(t-n)/2,u=0;u<i;u++)for(var l=0;l<n;l++){var f=(u+s)*t+l+s,c=e.data[4*(u*n+l)+3]/255;if(c===1)o[f]=0,a[f]=Ca;else if(c===0)o[f]=Ca,a[f]=0;else{var h=Math.max(0,.5-c),d=Math.max(0,c-.5);o[f]=h*h,a[f]=d*d}}}function a9(e,t,r,n,i,o,a){for(var s=0;s<t*r;s++){var u=Math.sqrt(n[s])-Math.sqrt(i[s]);e[s]=Math.round(255-255*(u/o+a))}}Bu.prototype._draw=function(e,t){var r=this.ctx.measureText(e),n=r.width,i=2*this.buffer,o,a,s,u,l,f,c,h;t&&this.useMetrics?(l=Math.floor(r.actualBoundingBoxAscent),h=this.buffer+Math.ceil(r.actualBoundingBoxAscent),f=this.buffer,c=this.buffer,a=Math.min(this.size,Math.ceil(r.actualBoundingBoxRight-r.actualBoundingBoxLeft)),u=Math.min(this.size-f,Math.ceil(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)),o=a+i,s=u+i,this.ctx.textBaseline="alphabetic"):(o=a=this.size,s=u=this.size,l=19*this.fontSize/24,f=c=0,h=this.middle,this.ctx.textBaseline="middle");var
  17. @font-face{
  18. font-family: '${t}';
  19. src: url('${r}') format('woff2'),
  20. url('${r}') format('woff'),
  21. url('${r}') format('truetype');
  22. }`,n.onload=()=>{if(document.fonts)try{document.fonts.load(`24px ${t}`,"L7text"),document.fonts.ready.then(()=>{this.emit("fontloaded",{fontFamily:t})})}catch(i){console.warn("当前环境不支持 document.fonts !"),console.warn("当前环境不支持 iconfont !"),console.warn(i)}},document.getElementsByTagName("head")[0].appendChild(n)}destroy(){this.cache.clear(),this.iconFontMap.clear()}generateFontAtlas(t,r,n){const{fontFamily:i,fontWeight:o,fontSize:a,buffer:s,sdf:u,radius:l,cutoff:f,iconfont:c}=this.fontOptions;let h=n&&n.data;h||(h=window.document.createElement("canvas"),h.width=ng);const d=h.getContext("2d",{willReadFrequently:!0});og(d,i,a,o);const{mapping:p,canvasHeight:v,xOffset:g,yOffset:y}=l9(he({getFontWidth:R=>d.measureText(R).width,fontHeight:a*ig,buffer:s,characterSet:r,maxCanvasWidth:ng},n&&{mapping:n.mapping,xOffset:n.xOffset,yOffset:n.yOffset})),S=d.getImageData(0,0,h.width,h.height);if(h.height=v,d.putImageData(S,0,0),og(d,i,a,o),u){const R=new u9(a,s,l,f,i,o),x=d.getImageData(0,0,R.size,R.size);for(const M of r){if(c){const $=String.fromCharCode(parseInt(M.replace("&#x","").replace(";",""),16)),F=R.draw($);ag(F,x)}else ag(R.draw(M),x);d.putImageData(x,p[M].x,p[M].y)}}else for(const R of r)d.fillText(R,p[R].x,p[R].y+a*g9);return{xOffset:g,yOffset:y,mapping:p,data:h,width:h.width,height:h.height}}getKey(){const{fontFamily:t,fontWeight:r}=this.fontOptions;return`${t}_${r}`}getNewChars(t,r){const n=this.cache.get(t);if(!n)return r;const i=[],o=n.mapping,a=new Set(Object.keys(o));return new Set(r).forEach(u=>{a.has(u)||i.push(u)}),i}}function sg(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(l){return void r(l)}s.done?t(u):Promise.resolve(u).then(n,i)}function ve(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(u){sg(o,n,i,a,s,"next",u)}function s(u){sg(o,n,i,a,s,"throw",u)}a(void 0)})}}const A9=3,ug=1024,Cs=64;class S9 extends Bn.EventEmitter{constructor(...t){super(...t),E(this,"canvasHeight",128),E(this,"texture",void 0),E(this,"canvas",void 0),E(this,"iconData",void 0),E(this,"iconMap",void 0),E(this,"ctx",void 0),E(this,"loadingImageCount",0)}isLoading(){return this.loadingImageCount===0}init(){this.iconData=[],this.iconMap={},this.canvas=window.document.createElement("canvas"),this.canvas.width=128,this.canvas.height=128,this.ctx=this.canvas.getContext("2d")}addImage(t,r){var n=this;return ve(function*(){let i=new Image;n.loadingImageCount++,n.hasImage(t)?console.warn("Image Id already exists"):n.iconData.push({id:t,size:Cs}),n.updateIconMap(),i=yield n.loadImage(r);const o=n.iconData.find(a=>a.id===t);o&&(o.image=i,o.width=i.width,o.height=i.height),n.update()})()}addImageMini(t,r,n){const i=n.getSceneConfig().canvas;let o=i.createImage();if(this.loadingImageCount++,this.hasImage(t))throw new Error("Image Id already exists");this.iconData.push({id:t,size:Cs}),this.updateIconMap(),this.loadImageMini(r,i).then(a=>{o=a;const s=this.iconData.find(u=>u.id===t);s&&(s.image=o,s.width=o.width,s.height=o.height),this.update()})}getTexture(){return this.texture}getIconMap(){return this.iconMap}getCanvas(){return this.canvas}hasImage(t){return this.iconMap.hasOwnProperty(t)}removeImage(t){this.hasImage(t)&&(this.iconData=this.iconData.filter(r=>r.id!==t),delete this.iconMap[t],this.update())}destroy(){this.removeAllListeners("imageUpdate"),this.iconData=[],this.iconMap={}}loadImage(t){return new Promise((r,n)=>{if(t instanceof HTMLImageElement){r(t);return}const i=new Image;i.crossOrigin="anonymous",i.onload=()=>{r(i)},i.onerror=()=>{n(new Error("Could not load image at "+t))},i.src=t instanceof File?URL.createObjectURL(t):t})}update(){this.updateIconMap(),this.updateIconAtlas(),this.loadingImageCount--,this.loadingImageCount===0&&this.emit("imageUpdate")}updateIconAtlas(){this.canvas.width=ug,this.canvas.height=this.canvasHeight,Object.keys(this.iconMap).forEach(t=>{const{x:r,y:n,image:i,width:o=64,height:a=64}=this.iconMap[t],u=Math.max(o,a)/Cs,l=a/u,f=o/u;i&&this.ctx.drawImage(i,r+(Cs-f)/2,n+(Cs-l)/2,f,l)})}updateIconMap(){const{mapping
  23. * http://hammerjs.github.io/
  24. *
  25. * Copyright (c) 2016 Jorik Tangelder;
  26. * Licensed under the MIT license */(function(e){(function(t,r,n,i){var o=["","webkit","Moz","MS","ms","o"],a=r.createElement("div"),s="function",u=Math.round,l=Math.abs,f=Date.now;function c(A,O,H){return setTimeout(R(A,H),O)}function h(A,O,H){return Array.isArray(A)?(d(A,H[O],H),!0):!1}function d(A,O,H){var ue;if(A)if(A.forEach)A.forEach(O,H);else if(A.length!==i)for(ue=0;ue<A.length;)O.call(H,A[ue],ue,A),ue++;else for(ue in A)A.hasOwnProperty(ue)&&O.call(H,A[ue],ue,A)}function p(A,O,H){var ue="DEPRECATED METHOD: "+O+`
  27. `+H+` AT
  28. `;return function(){var Le=new Error("get-stack-trace"),Qe=Le&&Le.stack?Le.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",Mt=t.console&&(t.console.warn||t.console.log);return Mt&&Mt.call(t.console,ue,Qe),A.apply(this,arguments)}}var v;typeof Object.assign!="function"?v=function(O){if(O===i||O===null)throw new TypeError("Cannot convert undefined or null to object");for(var H=Object(O),ue=1;ue<arguments.length;ue++){var Le=arguments[ue];if(Le!==i&&Le!==null)for(var Qe in Le)Le.hasOwnProperty(Qe)&&(H[Qe]=Le[Qe])}return H}:v=Object.assign;var g=p(function(O,H,ue){for(var Le=Object.keys(H),Qe=0;Qe<Le.length;)(!ue||ue&&O[Le[Qe]]===i)&&(O[Le[Qe]]=H[Le[Qe]]),Qe++;return O},"extend","Use `assign`."),y=p(function(O,H){return g(O,H,!0)},"merge","Use `assign`.");function S(A,O,H){var ue=O.prototype,Le;Le=A.prototype=Object.create(ue),Le.constructor=A,Le._super=ue,H&&v(Le,H)}function R(A,O){return function(){return A.apply(O,arguments)}}function x(A,O){return typeof A==s?A.apply(O&&O[0]||i,O):A}function M(A,O){return A===i?O:A}function $(A,O,H){d(q(O),function(ue){A.addEventListener(ue,H,!1)})}function F(A,O,H){d(q(O),function(ue){A.removeEventListener(ue,H,!1)})}function Y(A,O){for(;A;){if(A==O)return!0;A=A.parentNode}return!1}function ge(A,O){return A.indexOf(O)>-1}function q(A){return A.trim().split(/\s+/g)}function k(A,O,H){if(A.indexOf&&!H)return A.indexOf(O);for(var ue=0;ue<A.length;){if(H&&A[ue][H]==O||!H&&A[ue]===O)return ue;ue++}return-1}function G(A){return Array.prototype.slice.call(A,0)}function K(A,O,H){for(var ue=[],Le=[],Qe=0;Qe<A.length;){var Mt=A[Qe][O];k(Le,Mt)<0&&ue.push(A[Qe]),Le[Qe]=Mt,Qe++}return ue=ue.sort(function(Mr,Nr){return Mr[O]>Nr[O]}),ue}function ce(A,O){for(var H,ue,Le=O[0].toUpperCase()+O.slice(1),Qe=0;Qe<o.length;){if(H=o[Qe],ue=H?H+Le:O,ue in A)return ue;Qe++}return i}var Pe=1;function Xe(){return Pe++}function Je(A){var O=A.ownerDocument||A;return O.defaultView||O.parentWindow||t}var ft=/mobile|tablet|ip(ad|hone|od)|android/i,Ge="ontouchstart"in t,et=ce(t,"PointerEvent")!==i,vt=Ge&&ft.test(navigator.userAgent),mt="touch",It="pen",wt="mouse",gt="kinect",xr=25,Gt=1,Xr=2,le=4,ze=8,nt=1,Ae=2,Dt=4,Et=8,zt=16,Rt=Ae|Dt,ut=Et|zt,Ut=Rt|ut,$r=["x","y"],dr=["clientX","clientY"];function Jt(A,O){var H=this;this.manager=A,this.callback=O,this.element=A.element,this.target=A.options.inputTarget,this.domHandler=function(ue){x(A.options.enable,[A])&&H.handler(ue)},this.init()}Jt.prototype={handler:function(){},init:function(){this.evEl&&$(this.element,this.evEl,this.domHandler),this.evTarget&&$(this.target,this.evTarget,this.domHandler),this.evWin&&$(Je(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&F(this.element,this.evEl,this.domHandler),this.evTarget&&F(this.target,this.evTarget,this.domHandler),this.evWin&&F(Je(this.element),this.evWin,this.domHandler)}};function nn(A){var O,H=A.options.inputClass;return H?O=H:et?O=ts:vt?O=Bo:Ge?O=Do:O=Fo,new O(A,N)}function N(A,O,H){var ue=H.pointers.length,Le=H.changedPointers.length,Qe=O&Gt&&ue-Le===0,Mt=O&(le|ze)&&ue-Le===0;H.isFirst=!!Qe,H.isFinal=!!Mt,Qe&&(A.session={}),H.eventType=O,Si(A,H),A.emit("hammer.input",H),A.recognize(H),A.session.prevInput=H}function Si(A,O){var H=A.session,ue=O.pointers,Le=ue.length;H.firstInput||(H.firstInput=xi(O)),Le>1&&!H.firstMultiple?H.firstMultiple=xi(O):Le===1&&(H.firstMultiple=!1);var Qe=H.firstInput,Mt=H.firstMultiple,br=Mt?Mt.center:Qe.center,Mr=O.center=Kt(ue);O.timeStamp=f(),O.deltaTime=O.timeStamp-Qe.timeStamp,O.angle=qi(br,Mr),O.distance=on(br,Mr),wo(H,O),O.offsetDirection=$n(O.deltaX,O.deltaY);var Nr=Kr(O.deltaTime,O.deltaX,O.deltaY);O.overallVelocityX=Nr.x,O.overallVelocityY=Nr.y,O.overallVelocity=l(Nr.x)>l(Nr.y)?Nr.x:Nr.y,O.scale=Mt?Ki(Mt.pointers,ue):1,O.rotation=Mt?Br(Mt.pointers,ue):0,O.maxPointers=H.prevInput?O.pointers.length>H.prevInput.maxPointers?O.pointers.length:H.prevInput.maxPointers:O.pointers.length,ui(H,O);var xn=A.element;Y(O.srcEvent.target,xn)&&(xn=O.srcEvent.target),O.target=xn}function w
  29. position: absolute;
  30. z-index:2;
  31. height: 100%;
  32. width: 100%;
  33. pointer-events: none;
  34. `,r.id=`l7-scene-${J9++}`,r.classList.add("l7-scene"),t.appendChild(r),r}return null}function t$(e){var t;let r=!0;if((e==null||(t=e.target)===null||t===void 0?void 0:t.target)instanceof HTMLElement){var n;let o=e==null||(n=e.target)===null||n===void 0?void 0:n.target;for(;o;){var i;const a=Array.from(o.classList);if(a.includes("l7-marker")||a.includes("l7-popup")){r=!1;break}o=(i=o)===null||i===void 0?void 0:i.parentElement}}return r}let pu=function(e){return e[e.SAMPLED=0]="SAMPLED",e[e.RENDER_TARGET=1]="RENDER_TARGET",e}({});class r${constructor(t){var r=this;E(this,"pickedColors",void 0),E(this,"pickedTileLayers",[]),E(this,"pickingFBO",void 0),E(this,"width",0),E(this,"height",0),E(this,"alreadyInPicking",!1),E(this,"pickBufferScale",1),E(this,"pickFromPickingFBO",function(){var n=ve(function*(i,{x:o,y:a,lngLat:s,type:u,target:l}){var f;let c=!1;const{readPixels:h,readPixelsAsync:d,getViewportSize:p,queryVerdorInfo:v}=r.rendererService,{width:g,height:y}=p(),{enableHighlight:S,enableSelect:R}=i.getLayerConfig(),x=o*ln,M=a*ln;if(x>g-1*ln||x<0||M>y-1*ln||M<0)return!1;let $;if(v()==="WebGPU"?$=yield d({x:Math.floor(x/r.pickBufferScale),y:Math.floor((y-(a+1)*ln)/r.pickBufferScale),width:1,height:1,data:new Uint8Array(4),framebuffer:r.pickingFBO}):$=h({x:Math.floor(x/r.pickBufferScale),y:Math.floor((y-(a+1)*ln)/r.pickBufferScale),width:1,height:1,data:new Uint8Array(4),framebuffer:r.pickingFBO}),r.pickedColors=$,$[0]!==0||$[1]!==0||$[2]!==0){const Y=yo($),ge=i.layerPickService.getFeatureById(Y);Y!==i.getCurrentPickId()&&u==="mousemove"&&(u="mouseenter");const q={x:o,y:a,type:u,lngLat:s,featureId:Y,feature:ge,target:l};ge&&(c=!0,i.setCurrentPickId(Y),r.triggerHoverOnLayer(i,q))}else{const Y={x:o,y:a,lngLat:s,type:i.getCurrentPickId()!==null&&u==="mousemove"?"mouseout":"un"+u,featureId:null,target:l,feature:null};r.triggerHoverOnLayer(i,he(he({},Y),{},{type:"unpick"})),r.triggerHoverOnLayer(i,Y),i.setCurrentPickId(null)}if(S&&i.layerPickService.highlightPickedFeature($),R&&u==="click"&&((f=$)===null||f===void 0?void 0:f.toString())!==[0,0,0,0].toString()){const Y=yo($);i.getCurrentSelectedId()===null||Y!==i.getCurrentSelectedId()?(i.layerPickService.selectFeature($),i.setCurrentSelectedId(Y)):(i.layerPickService.selectFeature(new Uint8Array([0,0,0,0])),i.setCurrentSelectedId(null))}return c});return function(i,o){return n.apply(this,arguments)}}()),this.container=t}get mapService(){return this.container.mapService}get rendererService(){return this.container.rendererService}get configService(){return this.container.globalConfigService}get interactionService(){return this.container.interactionService}get layerService(){return this.container.layerService}init(t){const{createTexture2D:r,createFramebuffer:n,getViewportSize:i}=this.rendererService;let{width:o,height:a}=i();this.pickBufferScale=this.configService.getSceneConfig(t).pickBufferScale||1,o=Math.round(o/this.pickBufferScale),a=Math.round(a/this.pickBufferScale);const s=r({width:o,height:a,usage:pu.RENDER_TARGET,label:"Picking Texture"});this.pickingFBO=n({color:s,depth:!0,width:o,height:a}),this.interactionService.on(cn.Hover,this.pickingAllLayer.bind(this))}boxPickLayer(t,r,n){var i=this;return ve(function*(){const{useFramebufferAsync:o,clear:a}=i.rendererService;i.resizePickingFBO(),t.hooks.beforePickingEncode.call(),yield o(i.pickingFBO,ve(function*(){a({framebuffer:i.pickingFBO,color:[0,0,0,0],stencil:0,depth:1}),t.renderModels({ispick:!0})})),t.hooks.afterPickingEncode.call();const s=yield i.pickBox(t,r);n(s)})()}pickBox(t,r){var n=this;return ve(function*(){const[i,o,a,s]=r.map(y=>{const S=y<0?0:y;return Math.floor(S*ln/n.pickBufferScale)}),{readPixelsAsync:u,getViewportSize:l}=n.rendererService,{width:f,height:c}=l();if(i>(f-1)*ln/n.pickBufferScale||a<0||o>(c-1)*ln/n.pickBufferScale||s<0)return[];const h=Math.min(f/n.pickBufferScale,a)-i,d=Math.min(c/n.pickBufferScale,s)-o,p=yield u({x:i,y:Math.floor(c/n.pickBufferScale-(s+1)),width:h,height:d,data:new Uint8Array(h*d*4),framebuffer:n.pickingFBO}),v=[],g={};for(let y=0;y<p.length/4;y=y+1){const S=p.slice(y*4
  35. `;q+="."+$+" > div::-webkit-scrollbar { "+l(["display: none"])+` }
  36. `,q+="."+ge+" { "+l(["-webkit-animation-duration: 0.1s","animation-duration: 0.1s","-webkit-animation-name: "+Y,"animation-name: "+Y])+` }
  37. `,q+="@-webkit-keyframes "+Y+` { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }
  38. `,q+="@keyframes "+Y+" { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }",F(q)}}function h(x){x.className+=" "+s+"_animation_active"}function d(x,M,$){if(x.addEventListener)x.addEventListener(M,$);else if(x.attachEvent)x.attachEvent("on"+M,$);else return t.error("[scroll] Don't know how to add event listeners.")}function p(x,M,$){if(x.removeEventListener)x.removeEventListener(M,$);else if(x.detachEvent)x.detachEvent("on"+M,$);else return t.error("[scroll] Don't know how to remove event listeners.")}function v(x){return n(x).container.childNodes[0].childNodes[0].childNodes[0]}function g(x){return n(x).container.childNodes[0].childNodes[0].childNodes[1]}function y(x,M){var $=n(x).listeners;if(!$.push)throw new Error("Cannot add listener to an element that is not detectable.");n(x).listeners.push(M)}function S(x,M,$){$||($=M,M=x,x=null),x=x||{};function F(){if(x.debug){var le=Array.prototype.slice.call(arguments);if(le.unshift(i.get(M),"Scroll: "),t.log.apply)t.log.apply(null,le);else for(var ze=0;ze<le.length;ze++)t.log(le[ze])}}function Y(le){function ze(nt){var Ae=nt.getRootNode&&nt.getRootNode().contains(nt);return nt===nt.ownerDocument.body||nt.ownerDocument.body.contains(nt)||Ae}return!ze(le)||window.getComputedStyle(le)===null}function ge(le){var ze=n(le).container.childNodes[0],nt=window.getComputedStyle(ze);return!nt.width||nt.width.indexOf("px")===-1}function q(){var le=window.getComputedStyle(M),ze={};return ze.position=le.position,ze.width=M.offsetWidth,ze.height=M.offsetHeight,ze.top=le.top,ze.right=le.right,ze.bottom=le.bottom,ze.left=le.left,ze.widthCSS=le.width,ze.heightCSS=le.height,ze}function k(){var le=q();n(M).startSize={width:le.width,height:le.height},F("Element start size",n(M).startSize)}function G(){n(M).listeners=[]}function K(){if(F("storeStyle invoked."),!n(M)){F("Aborting because element has been uninstalled");return}var le=q();n(M).style=le}function ce(le,ze,nt){n(le).lastWidth=ze,n(le).lastHeight=nt}function Pe(le){return v(le).childNodes[0]}function Xe(){return 2*o.width+1}function Je(){return 2*o.height+1}function ft(le){return le+10+Xe()}function Ge(le){return le+10+Je()}function et(le){return le*2+Xe()}function vt(le){return le*2+Je()}function mt(le,ze,nt){var Ae=v(le),Dt=g(le),Et=ft(ze),zt=Ge(nt),Rt=et(ze),ut=vt(nt);Ae.scrollLeft=Et,Ae.scrollTop=zt,Dt.scrollLeft=Rt,Dt.scrollTop=ut}function It(){var le=n(M).container;if(!le){le=document.createElement("div"),le.className=s,le.style.cssText=l(["visibility: hidden","display: inline","width: 0px","height: 0px","z-index: -1","overflow: hidden","margin: 0","padding: 0"]),n(M).container=le,h(le),M.appendChild(le);var ze=function(){n(M).onRendered&&n(M).onRendered()};d(le,"animationstart",ze),n(M).onAnimationStart=ze}return le}function wt(){function le(){var Kt=n(M).style;if(Kt.position==="static"){M.style.setProperty("position","relative",x.important?"important":"");var Kr=function($n,on,qi,Br){function Ki(Qa){return Qa.replace(/[^-\d\.]/g,"")}var bi=qi[Br];bi!=="auto"&&Ki(bi)!=="0"&&($n.warn("An element that is positioned static has style."+Br+"="+bi+" which is ignored due to the static positioning. The element will need to be positioned relative, so the style."+Br+" will be set to 0. Element: ",on),on.style[Br]=0)};Kr(t,M,Kt,"top"),Kr(t,M,Kt,"right"),Kr(t,M,Kt,"bottom"),Kr(t,M,Kt,"left")}}function ze(Kt,Kr,$n,on){return Kt=Kt?Kt+"px":"0",Kr=Kr?Kr+"px":"0",$n=$n?$n+"px":"0",on=on?on+"px":"0",["left: "+Kt,"top: "+Kr,"right: "+on,"bottom: "+$n]}if(F("Injecting elements"),!n(M)){F("Aborting because element has been uninstalled");return}le();var nt=n(M).container;nt||(nt=It());var Ae=o.width,Dt=o.height,Et=l(["position: absolute","flex: none","overflow: hidden","z-index: -1","visibility: hidden","width: 100%","height: 100%","left: 0px","top: 0px"]),zt=l(["position: absolute","flex: none","overflow: hidden","z-index: -1","visibility: hidden"].concat(ze(-(1+Ae),-(1+Dt),-Dt,-Ae))),Rt=l(["position: absolute","flex: none","overflow: scroll","z-index: -1","visibility: hidden","width: 100%","height: 100%"]),ut=l(["position: absolute","flex:
  39. #define diffuseRatio 0.3
  40. #define specularRatio 0.2
  41. float calc_lighting(vec4 pos) {
  42. vec3 worldPos = vec3(pos * u_ModelMatrix);
  43. vec3 worldNormal = a_Normal;
  44. // //cal light weight
  45. vec3 viewDir = normalize(u_CameraPosition - worldPos);
  46. vec3 lightDir = normalize(vec3(1, -10.5, 12));
  47. vec3 halfDir = normalize(viewDir+lightDir);
  48. // //lambert
  49. float lambert = dot(worldNormal, lightDir);
  50. //specular
  51. float specular = pow(max(0.0, dot(worldNormal, halfDir)), 32.0);
  52. //sum to light weight
  53. float lightWeight = ambientRatio + diffuseRatio * lambert + specularRatio * specular;
  54. return lightWeight;
  55. }
  56. `,ez=`#define SHIFT_RIGHT17 1.0 / 131072.0
  57. #define SHIFT_RIGHT18 1.0 / 262144.0
  58. #define SHIFT_RIGHT19 1.0 / 524288.0
  59. #define SHIFT_RIGHT20 1.0 / 1048576.0
  60. #define SHIFT_RIGHT21 1.0 / 2097152.0
  61. #define SHIFT_RIGHT22 1.0 / 4194304.0
  62. #define SHIFT_RIGHT23 1.0 / 8388608.0
  63. #define SHIFT_RIGHT24 1.0 / 16777216.0
  64. #define SHIFT_LEFT17 131072.0
  65. #define SHIFT_LEFT18 262144.0
  66. #define SHIFT_LEFT19 524288.0
  67. #define SHIFT_LEFT20 1048576.0
  68. #define SHIFT_LEFT21 2097152.0
  69. #define SHIFT_LEFT22 4194304.0
  70. #define SHIFT_LEFT23 8388608.0
  71. #define SHIFT_LEFT24 16777216.0
  72. vec2 unpack_float(float packedValue) {
  73. int packedIntValue = int(packedValue);
  74. int v0 = packedIntValue / 256;
  75. return vec2(v0, packedIntValue - v0 * 256);
  76. }
  77. vec4 decode_color(vec2 encodedColor) {
  78. return vec4(
  79. unpack_float(encodedColor[0]) / 255.0,
  80. unpack_float(encodedColor[1]) / 255.0
  81. );
  82. }
  83. `,tz=`// Blinn-Phong model
  84. // apply lighting in vertex shader instead of fragment shader
  85. // @see https://learnopengl.com/Advanced-Lighting/Advanced-Lighting
  86. uniform float u_Ambient : 1.0;
  87. uniform float u_Diffuse : 1.0;
  88. uniform float u_Specular : 1.0;
  89. uniform int u_NumOfDirectionalLights : 1;
  90. uniform int u_NumOfSpotLights : 0;
  91. #define SHININESS 32.0
  92. #define MAX_NUM_OF_DIRECTIONAL_LIGHTS 3
  93. #define MAX_NUM_OF_SPOT_LIGHTS 3
  94. struct DirectionalLight {
  95. vec3 direction;
  96. vec3 ambient;
  97. vec3 diffuse;
  98. vec3 specular;
  99. };
  100. struct SpotLight {
  101. vec3 position;
  102. vec3 direction;
  103. vec3 ambient;
  104. vec3 diffuse;
  105. vec3 specular;
  106. float constant;
  107. float linear;
  108. float quadratic;
  109. float angle;
  110. float blur;
  111. float exponent;
  112. };
  113. uniform DirectionalLight u_DirectionalLights[MAX_NUM_OF_DIRECTIONAL_LIGHTS];
  114. uniform SpotLight u_SpotLights[MAX_NUM_OF_SPOT_LIGHTS];
  115. vec3 calc_directional_light(DirectionalLight light, vec3 normal, vec3 viewDir) {
  116. vec3 lightDir = normalize(light.direction);
  117. // diffuse shading
  118. float diff = max(dot(normal, lightDir), 0.0);
  119. // Blinn-Phong specular shading
  120. vec3 halfwayDir = normalize(lightDir + viewDir);
  121. float spec = pow(max(dot(normal, halfwayDir), 0.0), SHININESS);
  122. vec3 ambient = light.ambient * u_Ambient;
  123. vec3 diffuse = light.diffuse * diff * u_Diffuse;
  124. vec3 specular = light.specular * spec * u_Specular;
  125. return ambient + diffuse + specular;
  126. }
  127. vec3 calc_lighting(vec3 position, vec3 normal, vec3 viewDir) {
  128. vec3 weight = vec3(0.0);
  129. for (int i = 0; i < MAX_NUM_OF_DIRECTIONAL_LIGHTS; i++) {
  130. if (i >= u_NumOfDirectionalLights) {
  131. break;
  132. }
  133. weight += calc_directional_light(u_DirectionalLights[i], normal, viewDir);
  134. }
  135. return weight;
  136. }
  137. `,rz=`
  138. in vec4 v_PickingResult;
  139. #pragma include "picking_uniforms"
  140. #define PICKING_NONE 0.0
  141. #define PICKING_ENCODE 1.0
  142. #define PICKING_HIGHLIGHT 2.0
  143. #define COLOR_SCALE 1. / 255.
  144. #define HIGHLIGHT 1.0
  145. #define SELECT 2.0
  146. /*
  147. * Returns highlight color if this item is selected.
  148. */
  149. vec4 filterHighlightColor(vec4 color, float weight) {
  150. float activeType = v_PickingResult.a;
  151. if(activeType > 0.0) {
  152. vec4 highLightColor = activeType > 1.5 ? u_SelectColor : u_HighlightColor;
  153. highLightColor = highLightColor * COLOR_SCALE;
  154. float highLightAlpha = highLightColor.a;
  155. float highLightRatio = highLightAlpha / (highLightAlpha + color.a * (1.0 - highLightAlpha));
  156. vec3 resultRGB = mix(color.rgb, highLightColor.rgb, highLightRatio);
  157. return vec4(mix(resultRGB * weight, color.rgb, u_activeMix), color.a);
  158. }
  159. else {
  160. return color;
  161. }
  162. }
  163. /*
  164. * Returns picking color if picking enabled else unmodified argument.
  165. */
  166. vec4 filterPickingColor(vec4 color) {
  167. vec3 pickingColor = v_PickingResult.rgb;
  168. if (u_PickingStage == PICKING_ENCODE && length(pickingColor) < 0.001) {
  169. discard;
  170. }
  171. return u_PickingStage == PICKING_ENCODE ? vec4(pickingColor, step(0.001,color.a)): color;
  172. }
  173. /*
  174. * Returns picking color if picking is enabled if not
  175. * highlight color if this item is selected, otherwise unmodified argument.
  176. */
  177. vec4 filterColor(vec4 color) {
  178. // 过滤多余的 shader 计算
  179. // return color;
  180. if(u_shaderPick < 0.5) {
  181. return color; // 暂时去除 直接取消计算在选中时拖拽地图会有问题
  182. } else {
  183. return filterPickingColor(filterHighlightColor(color, 1.0));
  184. }
  185. }
  186. vec4 filterColorAlpha(vec4 color, float alpha) {
  187. // 过滤多余的 shader 计算
  188. // return color;
  189. if(u_shaderPick < 0.5) {
  190. return color; // 暂时去除 直接取消计算在选中时拖拽地图会有问题
  191. } else {
  192. return filterPickingColor(filterHighlightColor(color, alpha));
  193. }
  194. }
  195. `,nz=`layout(location = ATTRIBUTE_LOCATION_PICKING_COLOR) in vec3 a_PickingColor;
  196. out vec4 v_PickingResult;
  197. #pragma include "picking_uniforms"
  198. #define PICKING_NONE 0.0
  199. #define PICKING_ENCODE 1.0
  200. #define PICKING_HIGHLIGHT 2.0
  201. #define COLOR_SCALE 1. / 255.
  202. #define NORMAL 0.0
  203. #define HIGHLIGHT 1.0
  204. #define SELECT 2.0
  205. bool isVertexPicked(vec3 vertexColor) {
  206. return distance(vertexColor,u_PickingColor.rgb) < 0.01;
  207. }
  208. // 判断当前点是否已经被 select 选中
  209. bool isVertexSelected(vec3 vertexColor) {
  210. return distance(vertexColor,u_CurrentSelectedId.rgb) < 0.01;
  211. }
  212. void setPickingColor(vec3 pickingColor) {
  213. if(u_shaderPick < 0.5) {
  214. return;
  215. }
  216. // compares only in highlight stage
  217. if(u_PickingStage == PICKING_HIGHLIGHT) {
  218. if(isVertexPicked(pickingColor)) {
  219. v_PickingResult = vec4(pickingColor.rgb * COLOR_SCALE,HIGHLIGHT);
  220. return;
  221. }
  222. if(isVertexSelected(pickingColor)) {
  223. v_PickingResult = vec4(u_CurrentSelectedId.rgb * COLOR_SCALE,SELECT);
  224. return;
  225. }
  226. } else {
  227. v_PickingResult= vec4(pickingColor.rgb * COLOR_SCALE,NORMAL);
  228. return;
  229. }
  230. // // v_PickingResult.a = float((u_PickingStage == PICKING_HIGHLIGHT) && (isVertexPicked(pickingColor) || isVertexPicked(u_CurrentSelectedId)));
  231. // // Stores the picking color so that the fragment shader can render it during picking
  232. // v_PickingResult.rgb = pickingColor * COLOR_SCALE;
  233. }
  234. float setPickingSize(float x) {
  235. return u_PickingStage == PICKING_ENCODE ? x + u_PickingBuffer : x;
  236. }
  237. float setPickingOrder(float z) {
  238. bool selected = bool(v_PickingResult.a);
  239. return selected ? z + 1. : 0.;
  240. }
  241. `,xg=`layout(std140) uniform PickingUniforms {
  242. vec4 u_HighlightColor;
  243. vec4 u_SelectColor;
  244. vec3 u_PickingColor;
  245. float u_PickingStage;
  246. vec3 u_CurrentSelectedId;
  247. float u_PickingThreshold;
  248. float u_PickingBuffer;
  249. float u_shaderPick;
  250. float u_activeMix;
  251. };`,iz=`
  252. #define E 2.718281828459045
  253. vec2 ProjectFlat(vec2 lnglat){
  254. float maxs=85.0511287798;
  255. float lat=max(min(maxs,lnglat.y),-maxs);
  256. float scale= 268435456.;
  257. float d=PI/180.;
  258. float x=lnglat.x*d;
  259. float y=lat*d;
  260. y=log(tan((PI/4.)+(y/2.)));
  261. float a=.5/PI,
  262. b=.5,
  263. c=-.5/PI;
  264. d=.5;
  265. x=scale*(a*x+b);
  266. y=scale*(c*y+d);
  267. return vec2(x,y);
  268. }
  269. vec2 unProjectFlat(vec2 px){
  270. float a=.5/PI;
  271. float b=.5;
  272. float c=-.5/PI;
  273. float d=.5;
  274. float scale = 268435456.;
  275. float x=(px.x/scale-b)/a;
  276. float y=(px.y/scale-d)/c;
  277. y=(atan(pow(E,y))-(PI/4.))*2.;
  278. d=PI/180.;
  279. float lat=y/d;
  280. float lng=x/d;
  281. return vec2(lng,lat);
  282. }
  283. float pixelDistance(vec2 from, vec2 to) {
  284. vec2 a1 = ProjectFlat(from);
  285. vec2 b1 = ProjectFlat(to);
  286. return distance(a1, b1);
  287. }
  288. // gaode2.0
  289. vec2 customProject(vec2 lnglat) { // 经纬度 => 平面坐标
  290. float t = lnglat.x;
  291. float e = lnglat.y;
  292. float Sm = 180.0 / PI;
  293. float Tm = 6378137.0;
  294. float Rm = PI / 180.0;
  295. float r = 85.0511287798;
  296. e = max(min(r, e), -r);
  297. t *= Rm;
  298. e *= Rm;
  299. e = log(tan(PI / 4.0 + e / 2.0));
  300. return vec2(t * Tm, e * Tm);
  301. }
  302. vec2 unProjCustomCoord(vec2 point) { // 平面坐标 => 经纬度
  303. float Sm = 57.29577951308232; //180 / Math.PI
  304. float Tm = 6378137.0;
  305. float t = point.x;
  306. float e = point.y;
  307. return vec2(t / Tm * Sm, (2.0 * atan(exp(e / Tm)) - PI / 2.0) * Sm);
  308. }
  309. float customPixelDistance(vec2 from, vec2 to) {
  310. vec2 a1 = ProjectFlat(from);
  311. vec2 b1 = ProjectFlat(to);
  312. return distance(a1, b1);
  313. }`,bg=`#define TILE_SIZE (512.0)
  314. #define PI (3.1415926536)
  315. #define WORLD_SCALE (TILE_SIZE / (PI * 2.0))
  316. #define EARTH_CIRCUMFERENCE (40.03e6)
  317. #define COORDINATE_SYSTEM_LNGLAT (1.0) // mapbox
  318. #define COORDINATE_SYSTEM_LNGLAT_OFFSET (2.0) // mapbox offset
  319. #define COORDINATE_SYSTEM_VECTOR_TILE (3.0)
  320. #define COORDINATE_SYSTEM_IDENTITY (4.0)
  321. #define COORDINATE_SYSTEM_METER_OFFSET (5.0)
  322. #pragma include "scene_uniforms"
  323. const vec2 ZERO_64_XY_LOW = vec2(0.0, 0.0);
  324. // web mercator coords -> world coords
  325. vec2 project_mercator(vec2 lnglat) {
  326. float x = lnglat.x;
  327. return vec2(radians(x) + PI, PI - log(tan(PI * 0.25 + radians(lnglat.y) * 0.5)));
  328. }
  329. float project_scale(float meters) {
  330. return meters * u_PixelsPerMeter.z;
  331. }
  332. // offset coords -> world coords
  333. vec4 project_offset(vec4 offset) {
  334. float dy = offset.y;
  335. dy = clamp(dy, -1.0, 1.0);
  336. vec3 pixels_per_unit = u_PixelsPerDegree + u_PixelsPerDegree2 * dy;
  337. return vec4(offset.xyz * pixels_per_unit, offset.w);
  338. }
  339. vec3 project_normal(vec3 normal) {
  340. vec4 normal_modelspace = u_ModelMatrix * vec4(normal, 0.0);
  341. return normalize(normal_modelspace.xyz * u_PixelsPerMeter);
  342. }
  343. vec3 project_offset_normal(vec3 vector) {
  344. if (
  345. u_CoordinateSystem < COORDINATE_SYSTEM_LNGLAT + 0.01 &&
  346. u_CoordinateSystem > COORDINATE_SYSTEM_LNGLAT - 0.01 ||
  347. u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
  348. ) {
  349. // normals generated by the polygon tesselator are in lnglat offsets instead of meters
  350. return normalize(vector * u_PixelsPerDegree);
  351. }
  352. return project_normal(vector);
  353. }
  354. vec4 project_position(vec4 position, vec2 position64xyLow) {
  355. if (u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
  356. float X = position.x - u_ViewportCenter.x;
  357. float Y = position.y - u_ViewportCenter.y;
  358. return project_offset(
  359. vec4(X + position64xyLow.x, Y + position64xyLow.y, position.z, position.w)
  360. );
  361. }
  362. if (
  363. u_CoordinateSystem < COORDINATE_SYSTEM_LNGLAT + 0.01 &&
  364. u_CoordinateSystem > COORDINATE_SYSTEM_LNGLAT - 0.01
  365. ) {
  366. return vec4(
  367. project_mercator(position.xy) * WORLD_SCALE * u_ZoomScale,
  368. project_scale(position.z),
  369. position.w
  370. );
  371. }
  372. return position;
  373. }
  374. vec4 project_position(vec4 position) {
  375. return project_position(position, ZERO_64_XY_LOW);
  376. }
  377. vec2 project_pixel_size_to_clipspace(vec2 pixels) {
  378. vec2 offset = pixels / u_ViewportSize * u_DevicePixelRatio * 2.0;
  379. return offset * u_FocalDistance;
  380. }
  381. // 适配纹理贴图的等像素大小
  382. float project_pixel_texture(float pixel) {
  383. // mapbox zoom > 12
  384. if (u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
  385. return pixel * pow(0.5, u_Zoom) * u_FocalDistance;
  386. }
  387. return pixel * 2.0 * u_FocalDistance;
  388. }
  389. // 在不论什么底图下需要统一处理的时候使用
  390. float project_float_pixel(float pixel) {
  391. if (
  392. u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
  393. u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
  394. ) {
  395. // mapbox 坐标系下,为了和 Web 墨卡托坐标系统一,zoom 默认减1
  396. return pixel * pow(2.0, 19.0 - u_Zoom) * u_FocalDistance;
  397. }
  398. return pixel * u_FocalDistance;
  399. }
  400. // Project meter into the unit of pixel which used in the camera world space
  401. float project_float_meter(float meter) {
  402. if (
  403. u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
  404. u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
  405. ) {
  406. // Since the zoom level uniform is updated by mapservice and it's alread been subtracted by 1
  407. // Not sure if we are supposed to do that again
  408. return meter;
  409. } else {
  410. return project_float_pixel(meter);
  411. }
  412. // TODO: change the following code to make adaptations for amap
  413. // return u_FocalDistance * TILE_SIZE * pow(2.0, u_Zoom) * meter / EARTH_CIRCUMFERENCE;
  414. }
  415. float project_pixel(float pixel) {
  416. return pixel * u_FocalDistance;
  417. }
  418. vec2 project_pixel(vec2 pixel) {
  419. return pixel * -1.0 * u_FocalDistance;
  420. }
  421. vec3 project_pixel(vec3 pixel) {
  422. return pixel * -1.0 * u_FocalDistance;
  423. }
  424. vec4 project_common_position_to_clipspace(vec4 position, mat4 viewProjectionMatrix, vec4 center) {
  425. if (
  426. u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET ||
  427. u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
  428. ) {
  429. // Needs to be divided with project_uCommonUnitsPerMeter
  430. position.w *= u_PixelsPerMeter.z;
  431. }
  432. return viewProjectionMatrix * position + center;
  433. }
  434. // Projects from common space coordinates to clip space
  435. vec4 project_common_position_to_clipspace(vec4 position) {
  436. return project_common_position_to_clipspace(
  437. position,
  438. u_ViewProjectionMatrix,
  439. u_ViewportCenterProjection
  440. );
  441. }
  442. vec4 unproject_clipspace_to_position(vec4 clipspacePos, mat4 u_InverseViewProjectionMatrix) {
  443. vec4 pos = u_InverseViewProjectionMatrix * (clipspacePos - u_ViewportCenterProjection);
  444. if (
  445. u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET ||
  446. u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
  447. ) {
  448. // Needs to be divided with project_uCommonUnitsPerMeter
  449. pos.w = pos.w / u_PixelsPerMeter.z;
  450. }
  451. return pos;
  452. }
  453. bool isEqual(float a, float b) {
  454. return a < b + 0.001 && a > b - 0.001;
  455. }
  456. `,oz=`vec2 rotate_matrix(vec2 v, float a) {
  457. float b = a / 180.0 * 3.1415926535897932384626433832795;
  458. float s = sin(b);
  459. float c = cos(b);
  460. mat2 m = mat2(c, s, -s, c);
  461. return m * v;
  462. }`,Rg=`layout(std140) uniform SceneUniforms {
  463. mat4 u_ViewMatrix;
  464. mat4 u_ProjectionMatrix;
  465. mat4 u_ViewProjectionMatrix;
  466. mat4 u_ModelMatrix;
  467. vec4 u_ViewportCenterProjection;
  468. vec3 u_PixelsPerDegree;
  469. float u_Zoom;
  470. vec3 u_PixelsPerDegree2;
  471. float u_ZoomScale;
  472. vec3 u_PixelsPerMeter;
  473. float u_CoordinateSystem;
  474. vec3 u_CameraPosition;
  475. float u_DevicePixelRatio;
  476. vec2 u_ViewportCenter;
  477. vec2 u_ViewportSize;
  478. float u_FocalDistance;
  479. };
  480. `,az=`/**
  481. * 2D signed distance field functions
  482. * @see http://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
  483. */
  484. float ndot(vec2 a, vec2 b ) { return a.x*b.x - a.y*b.y; }
  485. float sdCircle(vec2 p, float r) {
  486. return length(p) - r;
  487. }
  488. float sdEquilateralTriangle(vec2 p) {
  489. float k = sqrt(3.0);
  490. p.x = abs(p.x) - 1.0;
  491. p.y = p.y + 1.0/k;
  492. if( p.x + k*p.y > 0.0 ) p = vec2(p.x-k*p.y,-k*p.x-p.y)/2.0;
  493. p.x -= clamp( p.x, -2.0, 0.0 );
  494. return -length(p)*sign(p.y);
  495. }
  496. float sdBox(vec2 p, vec2 b) {
  497. vec2 d = abs(p)-b;
  498. return length(max(d,vec2(0))) + min(max(d.x,d.y),0.0);
  499. }
  500. float sdPentagon(vec2 p, float r) {
  501. vec3 k = vec3(0.809016994,0.587785252,0.726542528);
  502. p.x = abs(p.x);
  503. p -= 2.0*min(dot(vec2(-k.x,k.y),p),0.0)*vec2(-k.x,k.y);
  504. p -= 2.0*min(dot(vec2( k.x,k.y),p),0.0)*vec2( k.x,k.y);
  505. p -= vec2(clamp(p.x,-r*k.z,r*k.z),r);
  506. return length(p)*sign(p.y);
  507. }
  508. float sdHexagon(vec2 p, float r) {
  509. vec3 k = vec3(-0.866025404,0.5,0.577350269);
  510. p = abs(p);
  511. p -= 2.0*min(dot(k.xy,p),0.0)*k.xy;
  512. p -= vec2(clamp(p.x, -k.z*r, k.z*r), r);
  513. return length(p)*sign(p.y);
  514. }
  515. float sdOctogon(vec2 p, float r) {
  516. vec3 k = vec3(-0.9238795325, 0.3826834323, 0.4142135623 );
  517. p = abs(p);
  518. p -= 2.0*min(dot(vec2( k.x,k.y),p),0.0)*vec2( k.x,k.y);
  519. p -= 2.0*min(dot(vec2(-k.x,k.y),p),0.0)*vec2(-k.x,k.y);
  520. p -= vec2(clamp(p.x, -k.z*r, k.z*r), r);
  521. return length(p)*sign(p.y);
  522. }
  523. float sdHexagram(vec2 p, float r) {
  524. vec4 k=vec4(-0.5,0.8660254038,0.5773502692,1.7320508076);
  525. p = abs(p);
  526. p -= 2.0*min(dot(k.xy,p),0.0)*k.xy;
  527. p -= 2.0*min(dot(k.yx,p),0.0)*k.yx;
  528. p -= vec2(clamp(p.x,r*k.z,r*k.w),r);
  529. return length(p)*sign(p.y);
  530. }
  531. float sdRhombus(vec2 p, vec2 b) {
  532. vec2 q = abs(p);
  533. float h = clamp((-2.0*ndot(q,b)+ndot(b,b))/dot(b,b),-1.0,1.0);
  534. float d = length( q - 0.5*b*vec2(1.0-h,1.0+h) );
  535. return d * sign( q.x*b.y + q.y*b.x - b.x*b.y );
  536. }
  537. float sdVesica(vec2 p, float r, float d) {
  538. p = abs(p);
  539. float b = sqrt(r*r-d*d); // can delay this sqrt
  540. return ((p.y-b)*d>p.x*b)
  541. ? length(p-vec2(0.0,b))
  542. : length(p-vec2(-d,0.0))-r;
  543. }
  544. `,Cg=/precision\s+(high|low|medium)p\s+float/,Og=`#ifdef GL_FRAGMENT_PRECISION_HIGH
  545. precision highp float;
  546. #else
  547. precision mediump float;
  548. #endif
  549. `,sz=/#pragma include (["^+"]?["[a-zA-Z_0-9](.*)"]*?)/g,uz=/void\s+main\s*\([^)]*\)\s*\{\n?/;class lz{constructor(){E(this,"moduleCache",{}),E(this,"rawContentCache",{})}registerBuiltinModules(){this.destroy(),this.registerModule("common",{vs:Sg,fs:Sg}),this.registerModule("decode",{vs:ez,fs:""}),this.registerModule("scene_uniforms",{vs:Rg,fs:Rg}),this.registerModule("picking_uniforms",{vs:xg,fs:xg}),this.registerModule("projection",{vs:bg,fs:bg}),this.registerModule("project",{vs:iz,fs:""}),this.registerModule("sdf_2d",{vs:"",fs:az}),this.registerModule("lighting",{vs:tz,fs:""}),this.registerModule("light",{vs:J$,fs:""}),this.registerModule("picking",{vs:nz,fs:rz}),this.registerModule("rotation_2d",{vs:oz,fs:""})}registerModule(t,r){r.vs=r.vs.replace(/\r\n/g,`
  550. `),r.fs=r.fs.replace(/\r\n/g,`
  551. `);const{vs:n,fs:i,uniforms:o,defines:a,inject:s}=r,{content:u,uniforms:l}=kh(n),{content:f,uniforms:c}=kh(i);this.rawContentCache[t]={fs:f,defines:a,inject:s,uniforms:he(he(he({},l),c),o),vs:u}}getModule(t){let r=this.rawContentCache[t].vs,n=this.rawContentCache[t].fs;const{defines:i={},inject:o={}}=this.rawContentCache[t];let a={};o["vs:#decl"]&&(r=o["vs:#decl"]+r,a=kh(o["vs:#decl"]).uniforms),o["vs:#main-start"]&&(r=r.replace(uz,v=>v+o["vs:#main-start"])),o["fs:#decl"]&&(n=o["fs:#decl"]+n),r=cz(i)+r;const{content:u,includeList:l}=this.processModule(r,[],"vs"),{content:f,includeList:c}=this.processModule(n,[],"fs"),h=Q$(l.concat(c).concat(t)).reduce((v,g)=>he(he({},v),this.rawContentCache[g].uniforms),he({},a)),d=(Cg.test(f)?"":Og)+u,p=(Cg.test(f)?"":Og)+f;return this.moduleCache[t]={vs:d.trim(),fs:p.trim(),uniforms:h},this.moduleCache[t]}destroy(){this.moduleCache={},this.rawContentCache={}}processModule(t,r,n){return{content:t.replace(sz,(o,a)=>{const u=a.split(" ")[0].replace(/"/g,"");if(r.indexOf(u)>-1)return"";const l=this.rawContentCache[u][n];r.push(u);const{content:f}=this.processModule(l,r,n);return f}),includeList:r}}}function cz(e){return Object.keys(e).reduce((r,n)=>r+`#define ${n.toUpperCase()} ${e[n]}
  552. `,`
  553. `)}class jp{constructor(){E(this,"shaderModuleService",void 0),E(this,"rendererService",void 0),E(this,"cameraService",void 0),E(this,"mapService",void 0),E(this,"interactionService",void 0),E(this,"layerService",void 0),E(this,"config",void 0)}getName(){return""}getType(){return Fu.Normal}init(t,r){this.config=r,this.rendererService=t.getContainer().rendererService,this.cameraService=t.getContainer().cameraService,this.mapService=t.getContainer().mapService,this.interactionService=t.getContainer().interactionService,this.layerService=t.getContainer().layerService,this.shaderModuleService=t.getContainer().shaderModuleService}render(t){}}class fz extends jp{getName(){return"clear"}init(t,r){super.init(t,r)}render(){this.rendererService.clear({color:[0,0,0,0],depth:1,framebuffer:null})}}class hz{constructor(t){E(this,"passes",[]),E(this,"layer",void 0),E(this,"renderFlag",void 0),E(this,"width",0),E(this,"height",0),this.postProcessor=t}setLayer(t){this.layer=t}setRenderFlag(t){this.renderFlag=t}getRenderFlag(){return this.renderFlag}getPostProcessor(){return this.postProcessor}render(){var t=this;return ve(function*(){for(const r of t.passes)yield r.render(t.layer);yield t.postProcessor.render(t.layer)})()}resize(t,r){(this.width!==t||this.height!==r)&&(this.postProcessor.resize(t,r),this.width=t,this.height=r)}add(t,r){t.getType()===Fu.PostProcessing?this.postProcessor.add(t,this.layer,r):(t.init(this.layer,r),this.passes.push(t))}insert(t,r,n){t.init(this.layer,r),this.passes.splice(n,0,t)}destroy(){this.passes.length=0}}class dz extends jp{constructor(...t){var r;super(...t),r=this,E(this,"pickingFBO",void 0),E(this,"layer",void 0),E(this,"width",0),E(this,"height",0),E(this,"alreadyInRendering",!1),E(this,"pickFromPickingFBO",({x:n,y:i,lngLat:o,type:a})=>{if(!this.layer.isVisible()||!this.layer.needPick(a))return;const{getViewportSize:s,readPixelsAsync:u,useFramebuffer:l}=this.rendererService,{width:f,height:c}=s(),{enableHighlight:h,enableSelect:d}=this.layer.getLayerConfig(),p=n*ln,v=i*ln;if(p>f||p<0||v>c||v<0)return;let g;l(this.pickingFBO,ve(function*(){var y;if(g=yield u({x:Math.round(p),y:Math.round(c-(i+1)*ln),width:1,height:1,data:new Uint8Array(1*1*4),framebuffer:r.pickingFBO}),g[0]!==0||g[1]!==0||g[2]!==0){const S=yo(g),R=r.layer.getSource().getFeatureById(S),x={x:n,y:i,type:a,lngLat:o,featureId:S,feature:R};R&&(r.layer.setCurrentPickId(S),r.triggerHoverOnLayer(x))}else{const S={x:n,y:i,lngLat:o,type:r.layer.getCurrentPickId()===null?"un"+a:"mouseout",featureId:null,feature:null};r.triggerHoverOnLayer(he(he({},S),{},{type:"unpick"})),r.triggerHoverOnLayer(S),r.layer.setCurrentPickId(null)}h&&r.highlightPickedFeature(g),d&&a==="click"&&((y=g)===null||y===void 0?void 0:y.toString())!==[0,0,0,0].toString()&&r.selectFeature(g)}))})}getType(){return Fu.Normal}getName(){return"pixelPicking"}init(t,r){super.init(t,r),this.layer=t;const{createTexture2D:n,createFramebuffer:i,getViewportSize:o}=this.rendererService,{width:a,height:s}=o(),u=n({width:a,height:s,wrapS:m.CLAMP_TO_EDGE,wrapT:m.CLAMP_TO_EDGE,label:"Picking Texture"});this.pickingFBO=i({color:u}),this.interactionService.on(cn.Hover,this.pickFromPickingFBO),this.interactionService.on(cn.Select,this.selectFeatureHandle.bind(this)),this.interactionService.on(cn.Active,this.highlightFeatureHandle.bind(this))}render(t){if(this.alreadyInRendering)return;const{getViewportSize:r,useFramebuffer:n,clear:i}=this.rendererService,{width:o,height:a}=r();this.alreadyInRendering=!0,(this.width!==o||this.height!==a)&&(this.pickingFBO.resize({width:o,height:a}),this.width=o,this.height=a),n(this.pickingFBO,()=>{i({framebuffer:this.pickingFBO,color:[0,0,0,0],stencil:0,depth:1});const s=this.layer.multiPassRenderer.getRenderFlag();this.layer.multiPassRenderer.setRenderFlag(!1),t.hooks.beforePickingEncode.call(),t.render(),t.hooks.afterPickingEncode.call(),this.layer.multiPassRenderer.setRenderFlag(s),this.alreadyInRendering=!1})}triggerHoverOnLayer(t){this.layer.emit(t.type,t)}highlightPickedFeature(t){const[r,n,i]=t;this.layer.hooks.beforeHighlight.call([r,n,i]),this.layerSer
  554. uniform float u_BloomFinal: 0.0;
  555. uniform sampler2D u_Texture;
  556. uniform sampler2D u_Texture2;
  557. uniform vec2 u_ViewportSize: [1.0, 1.0];
  558. uniform float u_radius: 5.0;
  559. uniform float u_intensity: 0.3;
  560. uniform float u_baseRadio: 0.5;
  561. // https://github.com/Jam3/glsl-fast-gaussian-blur/blob/master/9.glsl
  562. vec4 blur9(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) {
  563. vec4 color = vec4(0.0);
  564. vec2 off1 = vec2(1.3846153846) * direction;
  565. vec2 off2 = vec2(3.2307692308) * direction;
  566. color += texture2D(image, uv) * 0.2270270270;
  567. color += texture2D(image, uv + (off1 / resolution)) * 0.3162162162;
  568. color += texture2D(image, uv - (off1 / resolution)) * 0.3162162162;
  569. color += texture2D(image, uv + (off2 / resolution)) * 0.0702702703;
  570. color += texture2D(image, uv - (off2 / resolution)) * 0.0702702703;
  571. return color;
  572. }
  573. float luminance(vec4 color) {
  574. return 0.2125 * color.r + 0.7154 * color.g + 0.0721 * color.b;
  575. }
  576. void main() {
  577. // vec4 baseColor = texture2D(u_Texture, v_UV);
  578. float r = sqrt(u_radius);
  579. vec4 c1 = blur9(u_Texture, v_UV, u_ViewportSize, vec2(u_radius, 0.0));
  580. // c1 *= luminance(c1);
  581. vec4 c2 = blur9(u_Texture, v_UV, u_ViewportSize, vec2(0.0, u_radius));
  582. // c2 *= luminance(c2);
  583. vec4 c3 = blur9(u_Texture, v_UV, u_ViewportSize, vec2(r, r));
  584. // c3 *= luminance(c3);
  585. vec4 c4 = blur9(u_Texture, v_UV, u_ViewportSize, vec2(r, -r));
  586. // c4 *= luminance(c4);
  587. vec4 inbloomColor = (c1 + c2 + c3 + c4) * 0.25;
  588. // float lum = luminance(inbloomColor);
  589. // inbloomColor.rgb *= lum;
  590. if(u_BloomFinal > 0.0) {
  591. vec4 baseColor = texture2D(u_Texture2, v_UV);
  592. float baselum = luminance(baseColor);
  593. gl_FragColor = mix(inbloomColor, baseColor, u_baseRadio);
  594. if(baselum <= 0.2) {
  595. gl_FragColor = inbloomColor * u_intensity;
  596. }
  597. } else {
  598. gl_FragColor = inbloomColor;
  599. }
  600. }`,mz=`attribute vec2 a_Position;
  601. varying vec2 v_UV;
  602. void main() {
  603. v_UV = 0.5 * (a_Position + 1.0);
  604. gl_Position = vec4(a_Position, 0., 1.);
  605. }`,{isNil:Vh}=Sr;class gz extends Ai{setupShaders(){this.shaderModuleService.registerModule("blur-pass",{vs:mz,fs:vz});const{vs:t,fs:r,uniforms:n}=this.shaderModuleService.getModule("blur-pass"),{width:i,height:o}=this.rendererService.getViewportSize();return{vs:t,fs:r,uniforms:he(he({},n),{},{u_ViewportSize:[i,o]})}}convertOptionsToUniforms(t){const r={};return Vh(t.bloomRadius)||(r.u_radius=t.bloomRadius),Vh(t.bloomIntensity)||(r.u_intensity=t.bloomIntensity),Vh(t.bloomBaseRadio)||(r.u_baseRadio=t.bloomBaseRadio),r}}const Ez=`varying vec2 v_UV;
  606. uniform sampler2D u_Texture;
  607. uniform vec2 u_ViewportSize: [1.0, 1.0];
  608. uniform vec2 u_BlurDir: [1.0, 0.0];
  609. // https://github.com/Jam3/glsl-fast-gaussian-blur/blob/master/9.glsl
  610. vec4 blur9(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) {
  611. vec4 color = vec4(0.0);
  612. vec2 off1 = vec2(1.3846153846) * direction;
  613. vec2 off2 = vec2(3.2307692308) * direction;
  614. color += texture2D(image, uv) * 0.2270270270;
  615. color += texture2D(image, uv + (off1 / resolution)) * 0.3162162162;
  616. color += texture2D(image, uv - (off1 / resolution)) * 0.3162162162;
  617. color += texture2D(image, uv + (off2 / resolution)) * 0.0702702703;
  618. color += texture2D(image, uv - (off2 / resolution)) * 0.0702702703;
  619. return color;
  620. }
  621. void main() {
  622. gl_FragColor = blur9(u_Texture, v_UV, u_ViewportSize, u_BlurDir);
  623. }`,yz=`attribute vec2 a_Position;
  624. varying vec2 v_UV;
  625. void main() {
  626. v_UV = 0.5 * (a_Position + 1.0);
  627. gl_Position = vec4(a_Position, 0., 1.);
  628. }`,{isNil:Tz}=Sr;class Az extends Ai{setupShaders(){this.shaderModuleService.registerModule("blur-pass",{vs:yz,fs:Ez});const{vs:t,fs:r,uniforms:n}=this.shaderModuleService.getModule("blur-pass"),{width:i,height:o}=this.rendererService.getViewportSize();return{vs:t,fs:r,uniforms:he(he({},n),{},{u_ViewportSize:[i,o]})}}convertOptionsToUniforms(t){const r={};return Tz(t.blurRadius)||(r.u_BlurDir=[t.blurRadius,0]),r}}const Sz=`varying vec2 v_UV;
  629. uniform sampler2D u_Texture;
  630. uniform vec2 u_ViewportSize: [1.0, 1.0];
  631. uniform vec2 u_BlurDir: [1.0, 0.0];
  632. // https://github.com/Jam3/glsl-fast-gaussian-blur/blob/master/9.glsl
  633. vec4 blur9(sampler2D image, vec2 uv, vec2 resolution, vec2 direction) {
  634. vec4 color = vec4(0.0);
  635. vec2 off1 = vec2(1.3846153846) * direction;
  636. vec2 off2 = vec2(3.2307692308) * direction;
  637. color += texture2D(image, uv) * 0.2270270270;
  638. color += texture2D(image, uv + (off1 / resolution)) * 0.3162162162;
  639. color += texture2D(image, uv - (off1 / resolution)) * 0.3162162162;
  640. color += texture2D(image, uv + (off2 / resolution)) * 0.0702702703;
  641. color += texture2D(image, uv - (off2 / resolution)) * 0.0702702703;
  642. return color;
  643. }
  644. void main() {
  645. gl_FragColor = blur9(u_Texture, v_UV, u_ViewportSize, u_BlurDir);
  646. }`,xz=`attribute vec2 a_Position;
  647. varying vec2 v_UV;
  648. void main() {
  649. v_UV = 0.5 * (a_Position + 1.0);
  650. gl_Position = vec4(a_Position, 0., 1.);
  651. }`,{isNil:bz}=Sr;class Rz extends Ai{setupShaders(){this.shaderModuleService.registerModule("blur-pass",{vs:xz,fs:Sz});const{vs:t,fs:r,uniforms:n}=this.shaderModuleService.getModule("blur-pass"),{width:i,height:o}=this.rendererService.getViewportSize();return{vs:t,fs:r,uniforms:he(he({},n),{},{u_ViewportSize:[i,o]})}}convertOptionsToUniforms(t){const r={};return bz(t.blurRadius)||(r.u_BlurDir=[0,t.blurRadius]),r}}const Cz=`varying vec2 v_UV;
  652. uniform sampler2D u_Texture;
  653. uniform vec2 u_ViewportSize: [1.0, 1.0];
  654. uniform vec2 u_Center : [0.5, 0.5];
  655. uniform float u_Angle : 0;
  656. uniform float u_Size : 8;
  657. #pragma include "common"
  658. float scale = PI / u_Size;
  659. float pattern(float u_Angle, vec2 texSize, vec2 texCoord) {
  660. float s = sin(u_Angle), c = cos(u_Angle);
  661. vec2 tex = texCoord * texSize - u_Center * texSize;
  662. vec2 point = vec2(
  663. c * tex.x - s * tex.y,
  664. s * tex.x + c * tex.y
  665. ) * scale;
  666. return (sin(point.x) * sin(point.y)) * 4.0;
  667. }
  668. // https://github.com/evanw/glfx.js/blob/master/src/filters/fun/colorhalftone.js
  669. vec4 colorHalftone_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
  670. vec3 cmy = 1.0 - color.rgb;
  671. float k = min(cmy.x, min(cmy.y, cmy.z));
  672. cmy = (cmy - k) / (1.0 - k);
  673. cmy = clamp(
  674. cmy * 10.0 - 3.0 + vec3(
  675. pattern(u_Angle + 0.26179, texSize, texCoord),
  676. pattern(u_Angle + 1.30899, texSize, texCoord),
  677. pattern(u_Angle, texSize, texCoord)
  678. ),
  679. 0.0,
  680. 1.0
  681. );
  682. k = clamp(k * 10.0 - 5.0 + pattern(u_Angle + 0.78539, texSize, texCoord), 0.0, 1.0);
  683. return vec4(1.0 - cmy - k, color.a);
  684. }
  685. void main() {
  686. gl_FragColor = vec4(texture2D(u_Texture, v_UV));
  687. gl_FragColor = colorHalftone_filterColor(gl_FragColor, u_ViewportSize, v_UV);
  688. }`,Oz=`attribute vec2 a_Position;
  689. varying vec2 v_UV;
  690. void main() {
  691. v_UV = 0.5 * (a_Position + 1.0);
  692. gl_Position = vec4(a_Position, 0., 1.);
  693. }`;class Iz extends Ai{setupShaders(){this.shaderModuleService.registerModule("colorhalftone-pass",{vs:Oz,fs:Cz});const{vs:t,fs:r,uniforms:n}=this.shaderModuleService.getModule("colorhalftone-pass"),{width:i,height:o}=this.rendererService.getViewportSize();return{vs:t,fs:r,uniforms:he(he({},n),{},{u_ViewportSize:[i,o]})}}}const Mz=`varying vec2 v_UV;
  694. uniform sampler2D u_Texture;
  695. void main() {
  696. gl_FragColor = vec4(texture2D(u_Texture, v_UV));
  697. }`,Nz=`attribute vec2 a_Position;
  698. varying vec2 v_UV;
  699. void main() {
  700. v_UV = 0.5 * (a_Position + 1.0);
  701. gl_Position = vec4(a_Position, 0., 1.);
  702. }`;class Pz extends Ai{setupShaders(){return this.shaderModuleService.registerModule("copy-pass",{vs:Nz,fs:Mz}),this.shaderModuleService.getModule("copy-pass")}}const Lz=`varying vec2 v_UV;
  703. uniform sampler2D u_Texture;
  704. uniform vec2 u_ViewportSize: [1.0, 1.0];
  705. uniform vec2 u_Center : [0.5, 0.5];
  706. uniform float u_Scale : 10;
  707. // https://github.com/evanw/glfx.js/blob/master/src/filters/fun/hexagonalpixelate.js
  708. vec4 hexagonalPixelate_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
  709. vec2 tex = (texCoord * texSize - u_Center * texSize) / u_Scale;
  710. tex.y /= 0.866025404;
  711. tex.x -= tex.y * 0.5;
  712. vec2 a;
  713. if (tex.x + tex.y - floor(tex.x) - floor(tex.y) < 1.0) {
  714. a = vec2(floor(tex.x), floor(tex.y));
  715. }
  716. else a = vec2(ceil(tex.x), ceil(tex.y));
  717. vec2 b = vec2(ceil(tex.x), floor(tex.y));
  718. vec2 c = vec2(floor(tex.x), ceil(tex.y));
  719. vec3 TEX = vec3(tex.x, tex.y, 1.0 - tex.x - tex.y);
  720. vec3 A = vec3(a.x, a.y, 1.0 - a.x - a.y);
  721. vec3 B = vec3(b.x, b.y, 1.0 - b.x - b.y);
  722. vec3 C = vec3(c.x, c.y, 1.0 - c.x - c.y);
  723. float alen = length(TEX - A);
  724. float blen = length(TEX - B);
  725. float clen = length(TEX - C);
  726. vec2 choice;
  727. if (alen < blen) {
  728. if (alen < clen) choice = a;
  729. else choice = c;
  730. } else {
  731. if (blen < clen) choice = b;
  732. else choice = c;
  733. }
  734. choice.x += choice.y * 0.5;
  735. choice.y *= 0.866025404;
  736. choice *= u_Scale / texSize;
  737. return texture2D(texture, choice + u_Center);
  738. }
  739. void main() {
  740. gl_FragColor = vec4(texture2D(u_Texture, v_UV));
  741. gl_FragColor = hexagonalPixelate_sampleColor(u_Texture, u_ViewportSize, v_UV);
  742. }`,wz=`attribute vec2 a_Position;
  743. varying vec2 v_UV;
  744. void main() {
  745. v_UV = 0.5 * (a_Position + 1.0);
  746. gl_Position = vec4(a_Position, 0., 1.);
  747. }`;class Fz extends Ai{setupShaders(){this.shaderModuleService.registerModule("hexagonalpixelate-pass",{vs:wz,fs:Lz});const{vs:t,fs:r,uniforms:n}=this.shaderModuleService.getModule("hexagonalpixelate-pass"),{width:i,height:o}=this.rendererService.getViewportSize();return{vs:t,fs:r,uniforms:he(he({},n),{},{u_ViewportSize:[i,o]})}}}const Bz=`varying vec2 v_UV;
  748. uniform sampler2D u_Texture;
  749. uniform vec2 u_ViewportSize: [1.0, 1.0];
  750. uniform float u_Strength : 0.6;
  751. vec4 ink_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
  752. vec2 dx = vec2(1.0 / texSize.x, 0.0);
  753. vec2 dy = vec2(0.0, 1.0 / texSize.y);
  754. vec4 color = texture2D(texture, texCoord);
  755. float bigTotal = 0.0;
  756. float smallTotal = 0.0;
  757. vec3 bigAverage = vec3(0.0);
  758. vec3 smallAverage = vec3(0.0);
  759. for (float x = -2.0; x <= 2.0; x += 1.0) {
  760. for (float y = -2.0; y <= 2.0; y += 1.0) {
  761. vec3 sample = texture2D(texture, texCoord + dx * x + dy * y).rgb;
  762. bigAverage += sample;
  763. bigTotal += 1.0;
  764. if (abs(x) + abs(y) < 2.0) {
  765. smallAverage += sample;
  766. smallTotal += 1.0;
  767. }
  768. }
  769. }
  770. vec3 edge = max(vec3(0.0), bigAverage / bigTotal - smallAverage / smallTotal);
  771. float power = u_Strength * u_Strength * u_Strength * u_Strength * u_Strength;
  772. return vec4(color.rgb - dot(edge, edge) * power * 100000.0, color.a);
  773. }
  774. void main() {
  775. gl_FragColor = vec4(texture2D(u_Texture, v_UV));
  776. gl_FragColor = ink_sampleColor(u_Texture, u_ViewportSize, v_UV);
  777. }`,Dz=`attribute vec2 a_Position;
  778. varying vec2 v_UV;
  779. void main() {
  780. v_UV = 0.5 * (a_Position + 1.0);
  781. gl_Position = vec4(a_Position, 0., 1.);
  782. }`;class Uz extends Ai{setupShaders(){this.shaderModuleService.registerModule("ink-pass",{vs:Dz,fs:Bz});const{vs:t,fs:r,uniforms:n}=this.shaderModuleService.getModule("ink-pass"),{width:i,height:o}=this.rendererService.getViewportSize();return{vs:t,fs:r,uniforms:he(he({},n),{},{u_ViewportSize:[i,o]})}}}const kz=`varying vec2 v_UV;
  783. uniform sampler2D u_Texture;
  784. uniform float u_Amount : 0.5;
  785. float rand(vec2 co) {
  786. return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
  787. }
  788. // https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/noise.js
  789. vec4 noise_filterColor(vec4 color, vec2 texCoord) {
  790. float diff = (rand(texCoord) - 0.5) * u_Amount;
  791. color.r += diff;
  792. color.g += diff;
  793. color.b += diff;
  794. return color;
  795. }
  796. void main() {
  797. gl_FragColor = vec4(texture2D(u_Texture, v_UV));
  798. gl_FragColor = noise_filterColor(gl_FragColor, v_UV);
  799. }`,$z=`attribute vec2 a_Position;
  800. varying vec2 v_UV;
  801. void main() {
  802. v_UV = 0.5 * (a_Position + 1.0);
  803. gl_Position = vec4(a_Position, 0., 1.);
  804. }`;class zz extends Ai{setupShaders(){return this.shaderModuleService.registerModule("noise-pass",{vs:$z,fs:kz}),this.shaderModuleService.getModule("noise-pass")}}const Vz=`attribute vec2 a_Position;
  805. varying vec2 v_UV;
  806. void main() {
  807. v_UV = 0.5 * (a_Position + 1.0);
  808. gl_Position = vec4(a_Position, 0., 1.);
  809. }`,Hz=`varying vec2 v_UV;
  810. uniform sampler2D u_Texture;
  811. uniform float u_Amount : 0.5;
  812. // https://github.com/evanw/glfx.js/blob/master/src/filters/adjust/sepia.js
  813. vec4 sepia_filterColor(vec4 color) {
  814. float r = color.r;
  815. float g = color.g;
  816. float b = color.b;
  817. color.r =
  818. min(1.0, (r * (1.0 - (0.607 * u_Amount))) + (g * (0.769 * u_Amount)) + (b * (0.189 * u_Amount)));
  819. color.g = min(1.0, (r * 0.349 * u_Amount) + (g * (1.0 - (0.314 * u_Amount))) + (b * 0.168 * u_Amount));
  820. color.b = min(1.0, (r * 0.272 * u_Amount) + (g * 0.534 * u_Amount) + (b * (1.0 - (0.869 * u_Amount))));
  821. return color;
  822. }
  823. void main() {
  824. gl_FragColor = vec4(texture2D(u_Texture, v_UV));
  825. gl_FragColor = sepia_filterColor(gl_FragColor);
  826. }`;class jz extends Ai{setupShaders(){return this.shaderModuleService.registerModule("sepia-pass",{vs:Vz,fs:Hz}),this.shaderModuleService.getModule("sepia-pass")}}const OA=new X9;let Xz=0;function Wz(){const e=new lz,t=new Z9,r=new B9,n=new Y9(r),i=new T9,o=new S9,a=new k9,s=new $9,u=new U9,l={id:`${Xz++}`,globalConfigService:OA,shaderModuleService:e,debugService:t,cameraService:r,coordinateSystemService:n,fontService:i,iconService:o,markerService:a,popupService:s,controlService:u,customRenderService:{}},f=new i$(l);l.layerService=f;const c=new K$(l);l.sceneService=c;const h=new Q9(l);l.interactionService=h;const d=new r$(l);l.pickingService=d;const p={clear:new fz,pixelPicking:new dz,render:new _z};l.normalPassFactory=g=>p[g];const v={copy:new Pz,bloom:new gz,blurH:new Az,blurV:new Rz,noise:new zz,sepia:new jz,colorHalftone:new Iz,hexagonalPixelate:new Fz,ink:new Uz};return l.postProcessingPass=v,l.postProcessingPassFactory=g=>v[g],l}function su(e){const t=he({},e);return t.postProcessor=new pz(t.rendererService),t.multiPassRenderer=new hz(t.postProcessor),t.styleAttributeService=new f$(t.rendererService),t}const Nl=["loaded","fontloaded","maploaded","resize","destroy","dragstart","dragging","dragend","dragcancel"];let Hr=function(e){return e.IMAGE="image",e.CUSTOMIMAGE="customImage",e.ARRAYBUFFER="arraybuffer",e.RGB="rgb",e.TERRAINRGB="terrainRGB",e.CUSTOMRGB="customRGB",e.CUSTOMARRAYBUFFER="customArrayBuffer",e.CUSTOMTERRAINRGB="customTerrainRGB",e}({});var IA=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())}),Gz=(e,t,r,n)=>IA(void 0,null,function*(){return new Promise((i,o)=>{t({x:e.x,y:e.y,z:e.z},(a,s)=>{if(a||s.length===0){o(a);return}s&&Rd([{data:s,bands:[0]}],r,n,(u,l)=>{u?o(u):l&&i(l)})})})}),Yz=(e,t)=>IA(void 0,null,function*(){return new Promise((r,n)=>{t({x:e.x,y:e.y,z:e.z},(i,o)=>{if(i||!o){n(i);return}o instanceof ArrayBuffer?c2(o,(a,s)=>{a&&n(a),r(s)}):o instanceof HTMLImageElement?r(o):n(i)})})});function Zz(e,t){return Array.isArray(e)?typeof e[0]=="string"?e.map(r=>xa(r,t)):e.map(r=>({url:xa(r.url,t),bands:r.bands||[0]})):xa(e,t)}function qz(e){return typeof e=="string"?[{url:e,bands:[0]}]:typeof e[0]=="string"?e.map(t=>({url:t,bands:[0]})):e}function Ig(e,t){e.xhrCancel=()=>{t.map(r=>{r.abort()})}}var Kz=Object.defineProperty,Qz=Object.defineProperties,Jz=Object.getOwnPropertyDescriptors,Mg=Object.getOwnPropertySymbols,eV=Object.prototype.hasOwnProperty,tV=Object.prototype.propertyIsEnumerable,Ng=(e,t,r)=>t in e?Kz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Pg=(e,t)=>{for(var r in t||(t={}))eV.call(t,r)&&Ng(e,r,t[r]);if(Mg)for(var r of Mg(t))tV.call(t,r)&&Ng(e,r,t[r]);return e},Lg=(e,t)=>Qz(e,Jz(t)),MA=(e,t,r)=>new Promise((n,i)=>{var o=u=>{try{s(r.next(u))}catch(l){i(l)}},a=u=>{try{s(r.throw(u))}catch(l){i(l)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,a);s((r=r.apply(e,t)).next())}),rV=(e,t,r,n,i)=>MA(void 0,null,function*(){const o=qz(t.url);if(o.length>1){const{rasterFiles:a,xhrList:s,errList:u}=yield nV(o,t);if(Ig(e,s),u.length>0){r(u,null);return}Rd(a,n,i,r)}else{const a=_p(t,(s,u)=>{if(s)r(s);else if(u){const l=[{data:u,bands:o[0].bands}];Rd(l,n,i,r)}});Ig(e,[a])}});function nV(e,t){return MA(this,null,function*(){const r=[],n=[],i=[];for(let o=0;o<e.length;o++){const a=e[o],s=Lg(Pg({},t),{url:a.url}),u=a.bands,{err:l,data:f,xhr:c}=yield s2(Lg(Pg({},s),{type:"arrayBuffer"}));l&&i.push(l),n.push(c),r.push({data:f,bands:u})}return{rasterFiles:r,xhrList:n,errList:i}})}var iV=Object.defineProperty,oV=Object.defineProperties,aV=Object.getOwnPropertyDescriptors,wg=Object.getOwnPropertySymbols,sV=Object.prototype.hasOwnProperty,uV=Object.prototype.propertyIsEnumerable,Fg=(e,t,r)=>t in e?iV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ql=(e,t)=>{for(var r in t||(t={}))sV.call(t,r)&&Fg(e,r,t[r]);if(wg)for(var r of wg(t))uV.call(t,r)&&Fg(e,r,t[r]);return e},NA=(e,t)=>oV(e,aV(t)),PA=(e,t,r)=>new Promise((n,i
  827. `:r.push(` ${Ll[a]} u_${a};`),n+=`
  828. #ifdef USE_ATTRIBUTE_${s}
  829. layout(location = ${u}) in ${Ll[a]} a_${a.charAt(0).toUpperCase()+a.slice(1)};
  830. #endif
  831. `});const i=r.length?`
  832. layout(std140) uniform AttributeUniforms {
  833. ${r.join(`
  834. `)}
  835. };
  836. `:"";n+=i;let o="";return e.forEach(a=>{const s=a.replace(/([a-z])([A-Z])/g,"$1_$2").toUpperCase();o+=`
  837. #ifdef USE_ATTRIBUTE_${s}
  838. ${Ll[a]} ${a} = a_${a.charAt(0).toUpperCase()+a.slice(1)};
  839. #else
  840. ${Ll[a]} ${a} = u_${a};
  841. #endif
  842. `}),{"vs:#decl":n,"fs:#decl":i,"vs:#main-start":o}}let kE=function(e){return e.VERTICAL="vertical",e.HORIZONTAL="horizontal",e}({}),WW=function(e){return e.NORMAL="normal",e.REPLACE="replace",e}({}),t_=function(e){return e[e.pixel=0]="pixel",e[e.meter=1]="meter",e}({});const NS=100;function $E(e){return e/180*Math.acos(-1)}function PS(e){const t=$E(e[0])+Math.PI/2,r=$E(e[1]),n=NS+Math.random()*.4,i=n*Math.cos(r)*Math.cos(t),o=n*Math.cos(r)*Math.sin(t),a=n*Math.sin(r);return[o,a,i]}const zE=hn();hn();const Cn=hn(),ws=hn(),Bl=hn();function VE(e,t,r,n,i){ki(e,r,n),Ec(e,e),t=Cd(-e[1],e[0]);const o=Cd(-r[1],r[0]);return[i/Id(t,o),t]}function Fs(e,t){return L9(e,-t[1],t[0])}function Dl(e,t,r){return dA(e,t,r),Ec(e,e),e}function HE(e,t){return e[0]===t[0]&&e[1]===t[1]}class GW{constructor(t={}){E(this,"complex",void 0),E(this,"join",void 0),E(this,"cap",void 0),E(this,"miterLimit",void 0),E(this,"thickness",void 0),E(this,"normal",void 0),E(this,"lastFlip",-1),E(this,"miter",Cd(0,0)),E(this,"started",!1),E(this,"dash",!1),E(this,"totalDistance",0),E(this,"currentIndex",0),this.join=t.join||"miter",this.cap=t.cap||"butt",this.miterLimit=t.miterLimit||10,this.thickness=t.thickness||1,this.dash=t.dash||!1,this.complex={positions:[],indices:[],normals:[],startIndex:0,indexes:[]}}simpleExtrude(t){const r=this.complex;if(t.length<=1)return r;this.lastFlip=-1,this.started=!1,this.normal=null,this.totalDistance=0;const n=t.length;let i=r.startIndex;for(let o=1;o<n;o++){const a=t[o-1],s=t[o],u=o<t.length-1?t[o+1]:null,l=this.simpleSegment(r,i,a,s,u);i+=l}if(this.dash)for(let o=0;o<r.positions.length/6;o++)r.positions[o*6+5]=this.totalDistance;return r.startIndex=r.positions.length/6,r}extrude(t){const r=this.complex;if(t.length<=1)return r;this.lastFlip=-1,this.started=!1,this.normal=null,this.totalDistance=0;const n=t.length;let i=r.startIndex;for(let o=1;o<n;o++){const a=t[o-1],s=t[o],u=o<t.length-1?t[o+1]:null,l=this.segment(r,i,a,s,u);i+=l}if(this.dash)for(let o=0;o<r.positions.length/6;o++)r.positions[o*6+5]=this.totalDistance;return r.startIndex=r.positions.length/6,r}simpleSegment(t,r,n,i,o){let a=0;const s=t.indices,u=t.positions,l=t.normals,f=Pn([i[0],i[1]]),c=Pn([n[0],n[1]]);Dl(Cn,f,c);let h=0;if(this.dash&&(h=this.lineSegmentDistance(f,c),this.totalDistance+=h),this.normal||(this.normal=hn(),Fs(this.normal,Cn)),this.started||(this.started=!0,this.extrusions(u,l,n,this.normal,this.thickness,this.totalDistance-h)),s.push(r+0,r+1,r+2),!o)Fs(this.normal,Cn),this.extrusions(u,l,i,this.normal,this.thickness,this.totalDistance),s.push(...this.lastFlip===1?[r,r+2,r+3]:[r+2,r+1,r+3]),a+=2;else{const d=Pn([o[0],o[1]]);HE(f,d)&&ki(d,f,Ec(d,Od(d,f,c))),Dl(ws,d,f);const[p,v]=VE(Bl,hn(),Cn,ws,this.thickness);let g=Id(Bl,this.normal)<0?-1:1;this.extrusions(u,l,i,v,p,this.totalDistance),s.push(...this.lastFlip===1?[r,r+2,r+3]:[r+2,r+1,r+3]),g=-1,$h(this.normal,v),a+=2,this.lastFlip=g}return a}segment(t,r,n,i,o){let a=0;const s=t.indices,u=t.positions,l=t.normals,f=this.cap==="square",c=this.join==="bevel",h=Pn([i[0],i[1]]),d=Pn([n[0],n[1]]);Dl(Cn,h,d);let p=0;if(this.dash&&(p=this.lineSegmentDistance(h,d),this.totalDistance+=p),this.normal||(this.normal=hn(),Fs(this.normal,Cn)),!this.started)if(this.started=!0,f){const v=hn(),g=hn();ki(v,this.normal,Cn),ki(g,this.normal,Cn),l.push(g[0],g[1],0),l.push(v[0],v[1],0),u.push(n[0],n[1],n[2]|0,this.totalDistance-p,-this.thickness,n[2]|0),this.complex.indexes.push(this.currentIndex),u.push(n[0],n[1],n[2]|0,this.totalDistance-p,this.thickness,n[2]|0),this.complex.indexes.push(this.currentIndex),this.currentIndex++}else this.extrusions(u,l,n,this.normal,this.thickness,this.totalDistance-p);if(s.push(r+0,r+1,r+2),o){const v=Pn([o[0],o[1]]);HE(h,v)&&ki(v,h,Ec(v,Od(v,h,d))),Dl(ws,v,h);const[g,y]=VE(Bl,hn(),Cn,ws,this.thickness);let S=Id(Bl,this.normal)<0?-1:1,R=c;!R&&this.join==="miter"&&g>this.miterLimit&&(R=!0),R?(l.push(this.normal[0],this.normal[1],0),l.push(y[0],y[1],0),u.push(i[0],i[1],i[2]|0,this.totalDistance,-this.thickness*S,i[2]|0),this.complex.indexes.push(this.currentIndex),u.push(i[0],i[
  843. layout(std140) uniform commonUniforms {
  844. float u_opacity:1.0;
  845. float u_brightness:1.0;
  846. float u_contrast:1.0;
  847. float u_saturation:1.0;
  848. float u_gamma:1.0;
  849. };
  850. in vec2 v_texCoord;
  851. out vec4 outputColor;
  852. vec3 setContrast(vec3 rgb, float contrast) {
  853. vec3 color = mix(vec3(0.5), rgb, contrast);
  854. color = clamp(color, 0.0, 1.0);
  855. return color;
  856. }
  857. vec3 setSaturation(vec3 rgb, float adjustment) {
  858. const vec3 grayVector = vec3(0.2125, 0.7154, 0.0721);
  859. vec3 intensity = vec3(dot(rgb, grayVector));
  860. vec3 color = mix(intensity, rgb, adjustment);
  861. color = clamp(color, 0.0, 1.0);
  862. return color;
  863. }
  864. void main() {
  865. vec4 color = texture(SAMPLER_2D(u_texture),vec2(v_texCoord.x,v_texCoord.y));
  866. //brightness
  867. color.rgb = mix(vec3(0.0, 0.0, 0.0), color.rgb, u_brightness);
  868. //contrast
  869. color.rgb = setContrast(color.rgb, u_contrast);
  870. // saturation
  871. color.rgb = setSaturation(color.rgb, u_saturation);
  872. // gamma
  873. color.rgb = pow(color.rgb, vec3(u_gamma));
  874. outputColor = color;
  875. outputColor.a *= u_opacity;
  876. if(outputColor.a < 0.01)
  877. discard;
  878. }
  879. `,nG=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  880. layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
  881. layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
  882. layout(std140) uniform commonUniforms {
  883. float u_opacity:1.0;
  884. float u_brightness:1.0;
  885. float u_contrast:1.0;
  886. float u_saturation:1.0;
  887. float u_gamma:1.0;
  888. };
  889. out vec2 v_texCoord;
  890. #pragma include "projection"
  891. void main() {
  892. v_texCoord = a_Uv;
  893. vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
  894. gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));
  895. }
  896. `;let iG=class extends Qt{constructor(...t){super(...t),E(this,"texture",void 0)}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,UV:9})}getCommonUniformsInfo(){const{opacity:t,brightness:r,contrast:n,saturation:i,gamma:o}=this.layer.getLayerConfig(),a={u_opacity:bs(t,1),u_brightness:bs(r,1),u_contrast:bs(n,1),u_saturation:bs(i,1),u_gamma:bs(o,1)};return this.textures=[this.texture],this.getUniformsBufferInfo(a)}initModels(){var t=this;return ve(function*(){return yield t.loadTexture(),t.buildModels()})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy()}loadTexture(){var t=this;return ve(function*(){const{createTexture2D:r}=t.rendererService,i=yield t.layer.getSource().data.images;t.texture=r({data:i[0],width:i[0].width,height:i[0].height,mag:m.LINEAR,min:m.LINEAR})})()}buildModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"rasterImage",vertexShader:nG,fragmentShader:rG,defines:t.getDefines(),triangulation:_f,primitive:m.TRIANGLES,blend:{enable:!0},depth:{enable:!1},pickingEnabled:!1})]})()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_Uv",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:(t,r,n)=>[n[3],n[4]]}})}};const oG={image:iG};class aG extends Ka{constructor(...t){super(...t),E(this,"type","ImageLayer")}buildModels(){var t=this;return ve(function*(){const r=t.getModelType();t.layerModel=new oG[r](t),yield t.initLayerModels()})()}getDefaultConfig(){const t=this.getModelType();return{image:{}}[t]}getModelType(){return"image"}}const sG=`
  897. #define Animate 0.0
  898. #define LineTexture 1.0
  899. uniform sampler2D u_texture;
  900. layout(std140) uniform commonUniorm {
  901. vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
  902. vec4 u_dash_array;
  903. vec4 u_sourceColor;
  904. vec4 u_targetColor;
  905. vec2 u_textSize;
  906. float segmentNumber;
  907. float u_lineDir: 1.0;
  908. float u_icon_step: 100;
  909. float u_line_texture: 0.0;
  910. float u_textureBlend;
  911. float u_blur : 0.9;
  912. float u_line_type: 0.0;
  913. float u_time;
  914. float u_linearColor: 0.0;
  915. };
  916. in vec4 v_color;
  917. in vec2 v_iconMapUV;
  918. in vec4 v_lineData;
  919. //dash
  920. in vec4 v_dash_array;
  921. in float v_distance_ratio;
  922. out vec4 outputColor;
  923. #pragma include "picking"
  924. void main() {
  925. if(u_dash_array!=vec4(0.0)){
  926. float dashLength = mod(v_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);
  927. if(!(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z))) {
  928. discard;
  929. };
  930. }
  931. float animateSpeed = 0.0; // 运动速度
  932. outputColor = v_color;
  933. if(u_animate.x == Animate && u_line_texture != LineTexture) {
  934. animateSpeed = u_time / u_animate.y;
  935. float alpha =1.0 - fract( mod(1.0- v_lineData.b, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y);
  936. alpha = (alpha + u_animate.w -1.0) / u_animate.w;
  937. // alpha = smoothstep(0., 1., alpha);
  938. alpha = clamp(alpha, 0.0, 1.0);
  939. outputColor.a *= alpha;
  940. }
  941. // 当存在贴图时在底色上贴上贴图
  942. if(u_line_texture == LineTexture) { // while load texture
  943. float arcRadio = smoothstep( 0.0, 1.0, (v_lineData.r / segmentNumber));
  944. // float arcRadio = smoothstep( 0.0, 1.0, d_distance_ratio);
  945. float count = v_lineData.g; // 贴图在弧线上重复的数量
  946. float time = 0.0;
  947. if(u_animate.x == Animate) {
  948. time = u_time / u_animate.y;
  949. }
  950. float redioCount = arcRadio * count;
  951. float u = fract(redioCount - time);
  952. float v = v_lineData.a; // 横向 v
  953. vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;
  954. vec4 pattern = texture(SAMPLER_2D(u_texture), uv);
  955. if(u_animate.x == Animate) {
  956. float currentPlane = floor(redioCount - time);
  957. float textureStep = floor(count * u_animate.z);
  958. float a = mod(currentPlane, textureStep);
  959. if(a < textureStep - 1.0) {
  960. pattern = vec4(0.0);
  961. }
  962. }
  963. if(u_textureBlend == 0.0) { // normal
  964. pattern.a = 0.0;
  965. outputColor = filterColor(outputColor + pattern);
  966. } else { // replace
  967. pattern.a *= v_color.a;
  968. if(outputColor.a <= 0.0) {
  969. pattern.a = 0.0;
  970. }
  971. outputColor = filterColor(pattern);
  972. }
  973. } else {
  974. outputColor = filterColor(outputColor);
  975. }
  976. }`,uG=`#define Animate (0.0)
  977. #define LineTexture (1.0)
  978. layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  979. layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
  980. layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
  981. layout(location = ATTRIBUTE_LOCATION_INSTANCE) in vec4 a_Instance;
  982. layout(location = ATTRIBUTE_LOCATION_INSTANCE_64LOW) in vec4 a_Instance64Low;
  983. layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV;
  984. layout(std140) uniform commonUniorm {
  985. vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
  986. vec4 u_dash_array;
  987. vec4 u_sourceColor;
  988. vec4 u_targetColor;
  989. vec2 u_textSize;
  990. float segmentNumber;
  991. float u_lineDir: 1.0;
  992. float u_icon_step: 100;
  993. float u_line_texture: 0.0;
  994. float u_textureBlend;
  995. float u_blur : 0.9;
  996. float u_line_type: 0.0;
  997. float u_time;
  998. float u_linearColor: 0.0;
  999. };
  1000. out vec4 v_color;
  1001. out vec2 v_iconMapUV;
  1002. out vec4 v_lineData;
  1003. //dash
  1004. out vec4 v_dash_array;
  1005. out float v_distance_ratio;
  1006. #pragma include "projection"
  1007. #pragma include "project"
  1008. #pragma include "picking"
  1009. float bezier3(vec3 arr, float t) {
  1010. float ut = 1.0 - t;
  1011. return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;
  1012. }
  1013. vec2 midPoint(vec2 source, vec2 target, float arcThetaOffset) {
  1014. vec2 center = target - source;
  1015. float r = length(center);
  1016. float theta = atan(center.y, center.x);
  1017. float thetaOffset = arcThetaOffset;
  1018. float r2 = r / 2.0 / cos(thetaOffset);
  1019. float theta2 = theta + thetaOffset;
  1020. vec2 mid = vec2(r2 * cos(theta2) + source.x, r2 * sin(theta2) + source.y);
  1021. if (u_lineDir == 1.0) {
  1022. // 正向
  1023. return mid;
  1024. } else {
  1025. // 逆向
  1026. // (mid + vmin)/2 = (s + t)/2
  1027. vec2 vmid = source + target - mid;
  1028. return vmid;
  1029. }
  1030. // return mid;
  1031. }
  1032. float getSegmentRatio(float index) {
  1033. // dash: index / (segmentNumber - 1.);
  1034. // normal: smoothstep(0.0, 1.0, index / (segmentNumber - 1.));
  1035. return smoothstep(0.0, 1.0, index / (segmentNumber - 1.0));
  1036. // return index / (segmentNumber - 1.);
  1037. }
  1038. vec2 interpolate(vec2 source, vec2 target, float t, float arcThetaOffset) {
  1039. // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation
  1040. vec2 mid = midPoint(source, target, arcThetaOffset);
  1041. vec3 x = vec3(source.x, mid.x, target.x);
  1042. vec3 y = vec3(source.y, mid.y, target.y);
  1043. return vec2(bezier3(x, t), bezier3(y, t));
  1044. }
  1045. vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {
  1046. // normalized direction of the line
  1047. vec2 dir_screenspace = normalize(line_clipspace);
  1048. // rotate by 90 degrees
  1049. dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
  1050. vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;
  1051. return offset;
  1052. }
  1053. vec2 getNormal(vec2 line_clipspace, float offset_direction) {
  1054. // normalized direction of the line
  1055. vec2 dir_screenspace = normalize(line_clipspace);
  1056. // rotate by 90 degrees
  1057. dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
  1058. return dir_screenspace.xy * sign(offset_direction);
  1059. }
  1060. void main() {
  1061. //vs中计算渐变色
  1062. if (u_linearColor == 1.0) {
  1063. float d_segmentIndex = a_Position.x + 1.0; // 当前顶点在弧线中所处的分段位置
  1064. v_color = mix(u_sourceColor, u_targetColor, d_segmentIndex / segmentNumber);
  1065. } else {
  1066. v_color = a_Color;
  1067. }
  1068. v_color.a = v_color.a * opacity;
  1069. vec2 source_world = a_Instance.rg; // 起始点
  1070. vec2 target_world = a_Instance.ba; // 终点
  1071. float segmentIndex = a_Position.x;
  1072. float segmentRatio = getSegmentRatio(segmentIndex);
  1073. // 计算 dashArray 和 distanceRatio 输出到片元
  1074. float total_Distance = pixelDistance(source_world, target_world) / 2.0 * PI;
  1075. v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / total_Distance;
  1076. v_distance_ratio = segmentIndex / segmentNumber;
  1077. float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));
  1078. float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);
  1079. float d_distance_ratio;
  1080. if(u_animate.x == Animate) {
  1081. d_distance_ratio = segmentIndex / segmentNumber;
  1082. if(u_lineDir != 1.0) {
  1083. d_distance_ratio = 1.0 - d_distance_ratio;
  1084. }
  1085. }
  1086. v_lineData.b = d_distance_ratio;
  1087. vec4 source = project_position(vec4(source_world, 0, 1.), a_Instance64Low.xy);
  1088. vec4 target = project_position(vec4(target_world, 0, 1.), a_Instance64Low.zw);
  1089. vec2 currPos = interpolate(source.xy, target.xy, segmentRatio, thetaOffset);
  1090. vec2 nextPos = interpolate(source.xy, target.xy, nextSegmentRatio, thetaOffset);
  1091. vec2 offset = project_pixel(
  1092. getExtrusionOffset((nextPos.xy - currPos.xy) * indexDir, a_Position.y)
  1093. );
  1094. float d_segmentIndex = a_Position.x + 1.0; // 当前顶点在弧线中所处的分段位置
  1095. v_lineData.r = d_segmentIndex;
  1096. if(LineTexture == u_line_texture) { // 开启贴图模式
  1097. float arcDistrance = length(source - target); // 起始点和终点的距离
  1098. arcDistrance = project_pixel(arcDistrance);
  1099. v_iconMapUV = a_iconMapUV;
  1100. float pixelLen = project_pixel_texture(u_icon_step); // 贴图沿弧线方向的长度 - 随地图缩放改变
  1101. float texCount = floor(arcDistrance / pixelLen); // 贴图在弧线上重复的数量
  1102. v_lineData.g = texCount;
  1103. float lineOffsetWidth = length(offset + offset * sign(a_Position.y)); // 线横向偏移的距离
  1104. float linePixelSize = project_pixel(a_Size); // 定点位置偏移
  1105. v_lineData.a = lineOffsetWidth / linePixelSize; // 线图层贴图部分的 v 坐标值
  1106. }
  1107. gl_Position = project_common_position_to_clipspace(vec4(currPos.xy + offset, 0, 1.0));
  1108. setPickingColor(a_PickingColor);
  1109. }
  1110. `,lG={solid:0,dash:1};class cG extends Qt{constructor(...t){super(...t),E(this,"texture",void 0),E(this,"updateTexture",()=>{const{createTexture2D:r}=this.rendererService;if(this.texture){this.texture.update({data:this.iconService.getCanvas()}),this.layer.render();return}this.texture=r({data:this.iconService.getCanvas(),mag:m.NEAREST,min:m.NEAREST,premultiplyAlpha:!1,width:1024,height:this.iconService.canvasHeight||128}),this.textures=[this.texture]})}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,INSTANCE:10,INSTANCE_64LOW:11,UV:12,THETA_OFFSET:13})}getCommonUniformsInfo(){const{sourceColor:t,targetColor:r,textureBlend:n="normal",lineType:i="solid",dashArray:o=[10,5],forward:a=!0,lineTexture:s=!1,iconStep:u=100,segmentNumber:l=30}=this.layer.getLayerConfig(),{animateOption:f}=this.layer.getLayerConfig();let c=o;i!=="dash"&&(c=[0,0]),c.length===2&&c.push(0,0);let h=0,d=[0,0,0,0],p=[0,0,0,0];if(t&&r&&(d=Zt(t),p=Zt(r),h=1),this.rendererService.getDirty()){var v;(v=this.texture)===null||v===void 0||v.bind()}const g={u_animate:this.animateOption2Array(f),u_dash_array:c,u_sourceColor:d,u_targetColor:p,u_textSize:[1024,this.iconService.canvasHeight||128],segmentNumber:l,u_lineDir:a?1:-1,u_icon_step:u,u_line_texture:s?1:0,u_textureBlend:n==="normal"?0:1,u_blur:.9,u_line_type:lG[i||"solid"],u_time:this.layer.getLayerAnimateTime()||0,u_linearColor:h};return this.getUniformsBufferInfo(g)}initModels(){var t=this;return ve(function*(){return t.updateTexture(),t.iconService.on("imageUpdate",t.updateTexture),t.buildModels()})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy(),this.iconService.off("imageUpdate",this.updateTexture)}getShaders(){return{frag:sG,vert:uG,type:""}}buildModels(){var t=this;return ve(function*(){t.initUniformsBuffer();const{segmentNumber:r=30}=t.layer.getLayerConfig(),{frag:n,vert:i,type:o}=t.getShaders();return[yield t.layer.buildLayerModel({moduleName:"lineArc2d"+o,vertexShader:i,fragmentShader:n,defines:t.getDefines(),inject:t.getInject(),triangulation:r_,depth:{enable:!1},styleOption:{segmentNumber:r}})]})()}registerBuiltinAttributes(){this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=1}=t;return Array.isArray(r)?[r[0]]:[r]}}}),this.styleAttributeService.registerStyleAttribute({name:"instance",type:qe.Attribute,descriptor:{name:"a_Instance",shaderLocation:this.attributeLocation.INSTANCE,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n)=>[n[3],n[4],n[5],n[6]]}}),this.styleAttributeService.registerStyleAttribute({name:"instance64Low",type:qe.Attribute,descriptor:{name:"a_Instance64Low",shaderLocation:this.attributeLocation.INSTANCE_64LOW,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n)=>[Ir(n[3]),Ir(n[4]),Ir(n[5]),Ir(n[6])]}}),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_iconMapUV",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const r=this.iconService.getIconMap(),{texture:n}=t,{x:i,y:o}=r[n]||{x:0,y:0};return[i,o]}}}),this.styleAttributeService.registerStyleAttribute({name:"thetaOffset",type:qe.Attribute,descriptor:{name:"a_ThetaOffset",shaderLocation:this.attributeLocation.THETA_OFFSET,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{thetaOffset:r=1}=t;return[r]}}})}}const fG=`#define LineTypeSolid 0.0
  1111. #define LineTypeDash 1.0
  1112. #define Animate 0.0
  1113. #define LineTexture 1.0
  1114. uniform sampler2D u_texture;
  1115. layout(std140) uniform commonUniorm {
  1116. vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
  1117. vec4 u_dash_array: [10.0, 5., 0, 0];
  1118. vec4 u_sourceColor;
  1119. vec4 u_targetColor;
  1120. vec2 u_textSize;
  1121. float u_globel;
  1122. float u_globel_radius;
  1123. float u_global_height: 10;
  1124. float segmentNumber;
  1125. float u_line_type: 0.0;
  1126. float u_icon_step: 100;
  1127. float u_line_texture: 0.0;
  1128. float u_textureBlend;
  1129. float u_time;
  1130. float u_linearColor: 0.0;
  1131. };
  1132. in vec4 v_color;
  1133. in vec4 v_dash_array;
  1134. in float v_segmentIndex;
  1135. in vec2 v_iconMapUV;
  1136. in vec4 v_line_data;
  1137. out vec4 outputColor;
  1138. #pragma include "picking"
  1139. void main() {
  1140. float animateSpeed = 0.0; // 运动速度
  1141. float d_distance_ratio = v_line_data.g; // 当前点位距离占线总长的比例
  1142. outputColor = v_color;
  1143. if(u_line_type == LineTypeDash) {
  1144. float flag = 0.;
  1145. float dashLength = mod(d_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);
  1146. if(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z)) {
  1147. flag = 1.;
  1148. }
  1149. outputColor.a *=flag;
  1150. }
  1151. if(u_animate.x == Animate && u_line_texture != LineTexture) {
  1152. animateSpeed = u_time / u_animate.y;
  1153. float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y);
  1154. alpha = (alpha + u_animate.w -1.0) / u_animate.w;
  1155. // alpha = smoothstep(0., 1., alpha);
  1156. alpha = clamp(alpha, 0.0, 1.0);
  1157. outputColor.a *= alpha;
  1158. // u_animate
  1159. // x enable
  1160. // y duration
  1161. // z interval
  1162. // w trailLength
  1163. }
  1164. if(u_line_texture == LineTexture && u_line_type != LineTypeDash) { // while load texture
  1165. // float arcRadio = smoothstep( 0.0, 1.0, (v_segmentIndex / segmentNumber));
  1166. float arcRadio = v_segmentIndex / (segmentNumber - 1.0);
  1167. float count = v_line_data.b; // // 贴图在弧线上重复的数量
  1168. float time = 0.0;
  1169. if(u_animate.x == Animate) {
  1170. time = u_time / u_animate.y;
  1171. }
  1172. float redioCount = arcRadio * count;
  1173. float u = fract(redioCount - time);
  1174. float v = v_line_data.a; // 线图层贴图部分的 v 坐标值
  1175. vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;
  1176. vec4 pattern = texture(SAMPLER_2D(u_texture), uv);
  1177. if(u_animate.x == Animate) {
  1178. float currentPlane = floor(redioCount - time);
  1179. float textureStep = floor(count * u_animate.z);
  1180. float a = mod(currentPlane, textureStep);
  1181. if(a < textureStep - 1.0) {
  1182. pattern = vec4(0.0);
  1183. }
  1184. }
  1185. if(u_textureBlend == 0.0) { // normal
  1186. pattern.a = 0.0;
  1187. outputColor = filterColor(outputColor + pattern);
  1188. } else { // replace
  1189. pattern.a *= v_color.a;
  1190. if(outputColor.a <= 0.0) {
  1191. pattern.a = 0.0;
  1192. discard;
  1193. } else {
  1194. outputColor = filterColor(pattern);
  1195. }
  1196. }
  1197. } else {
  1198. outputColor = filterColor(outputColor);
  1199. }
  1200. }
  1201. `,hG=`#define LineTypeSolid 0.0
  1202. #define LineTypeDash 1.0
  1203. #define Animate 0.0
  1204. #define LineTexture 1.0
  1205. layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  1206. layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
  1207. layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
  1208. layout(location = ATTRIBUTE_LOCATION_INSTANCE) in vec4 a_Instance;
  1209. layout(location = ATTRIBUTE_LOCATION_INSTANCE_64LOW) in vec4 a_Instance64Low;
  1210. layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV;
  1211. layout(std140) uniform commonUniorm {
  1212. vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
  1213. vec4 u_dash_array: [10.0, 5., 0, 0];
  1214. vec4 u_sourceColor;
  1215. vec4 u_targetColor;
  1216. vec2 u_textSize;
  1217. float u_globel;
  1218. float u_globel_radius;
  1219. float u_global_height: 10;
  1220. float segmentNumber;
  1221. float u_line_type: 0.0;
  1222. float u_icon_step: 100;
  1223. float u_line_texture: 0.0;
  1224. float u_textureBlend;
  1225. float u_time;
  1226. float u_linearColor: 0.0;
  1227. };
  1228. out vec4 v_color;
  1229. out vec4 v_dash_array;
  1230. out float v_segmentIndex;
  1231. out vec2 v_iconMapUV;
  1232. out vec4 v_line_data;
  1233. #pragma include "projection"
  1234. #pragma include "project"
  1235. #pragma include "picking"
  1236. float maps (float value, float start1, float stop1, float start2, float stop2) {
  1237. return start2 + (stop2 - start2) * ((value - start1) / (stop1 - start1));
  1238. }
  1239. float getSegmentRatio(float index) {
  1240. return smoothstep(0.0, 1.0, index / (segmentNumber - 1.0));
  1241. }
  1242. float paraboloid(vec2 source, vec2 target, float ratio) {
  1243. vec2 x = mix(source, target, ratio);
  1244. vec2 center = mix(source, target, 0.5);
  1245. float dSourceCenter = distance(source, center);
  1246. float dXCenter = distance(x, center);
  1247. return (dSourceCenter + dXCenter) * (dSourceCenter - dXCenter);
  1248. }
  1249. vec3 getPos(vec2 source, vec2 target, float segmentRatio) {
  1250. float vertex_height = paraboloid(source, target, segmentRatio);
  1251. return vec3(
  1252. mix(source, target, segmentRatio),
  1253. sqrt(max(0.0, vertex_height))
  1254. );
  1255. }
  1256. vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {
  1257. // normalized direction of the line
  1258. vec2 dir_screenspace = normalize(line_clipspace);
  1259. // rotate by 90 degrees
  1260. dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
  1261. vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;
  1262. return offset;
  1263. }
  1264. vec2 getNormal(vec2 line_clipspace, float offset_direction) {
  1265. // normalized direction of the line
  1266. vec2 dir_screenspace = normalize(line_clipspace);
  1267. // rotate by 90 degrees
  1268. dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
  1269. return dir_screenspace.xy * sign(offset_direction);
  1270. }
  1271. float torad(float deg) {
  1272. return (deg / 180.0) * acos(-1.0);
  1273. }
  1274. vec3 lglt2xyz(vec2 lnglat) {
  1275. float pi = 3.1415926;
  1276. // + Math.PI/2 是为了对齐坐标
  1277. float lng = torad(lnglat.x) + pi / 2.0;
  1278. float lat = torad(lnglat.y);
  1279. // 手动增加一些偏移,减轻面的冲突
  1280. float radius = u_globel_radius;
  1281. float z = radius * cos(lat) * cos(lng);
  1282. float x = radius * cos(lat) * sin(lng);
  1283. float y = radius * sin(lat);
  1284. return vec3(x, y, z);
  1285. }
  1286. void main() {
  1287. //vs中计算渐变色
  1288. if(u_linearColor==1.0){
  1289. float d_segmentIndex = a_Position.x + 1.0; // 当前顶点在弧线中所处的分段位置
  1290. v_color = mix(u_sourceColor, u_targetColor, d_segmentIndex/segmentNumber);
  1291. }
  1292. else{
  1293. v_color = a_Color;
  1294. }
  1295. v_color.a = v_color.a * opacity;
  1296. vec2 source = project_position(vec4(a_Instance.rg, 0, 0), a_Instance64Low.xy).xy;
  1297. vec2 target = project_position(vec4(a_Instance.ba, 0, 0), a_Instance64Low.zw).xy;
  1298. float segmentIndex = a_Position.x;
  1299. float segmentRatio = getSegmentRatio(segmentIndex);
  1300. float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));
  1301. float d_distance_ratio;
  1302. if(u_line_type == LineTypeDash) {
  1303. d_distance_ratio = segmentIndex / segmentNumber;
  1304. float total_Distance = pixelDistance(source, target) / 2.0 * PI;
  1305. v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / (total_Distance / segmentNumber * segmentIndex);
  1306. }
  1307. if(u_animate.x == Animate) {
  1308. d_distance_ratio = segmentIndex / segmentNumber;
  1309. }
  1310. v_line_data.g = d_distance_ratio; // 当前点位距离占线总长的比例
  1311. float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);
  1312. vec3 curr = getPos(source, target, segmentRatio);
  1313. vec3 next = getPos(source, target, nextSegmentRatio);
  1314. vec2 offset = getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y);
  1315. // v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);
  1316. v_segmentIndex = a_Position.x;
  1317. if(LineTexture == u_line_texture && u_line_type != LineTypeDash) { // 开启贴图模式
  1318. float arcDistrance = length(source - target);
  1319. float pixelLen = project_pixel_texture(u_icon_step);
  1320. v_line_data.b = floor(arcDistrance/pixelLen); // 贴图在弧线上重复的数量
  1321. vec2 projectOffset = project_pixel(offset);
  1322. float lineOffsetWidth = length(projectOffset + projectOffset * sign(a_Position.y)); // 线横向偏移的距离
  1323. float linePixelSize = project_pixel(a_Size); // 定点位置偏移,按地图等级缩放后的距离
  1324. v_line_data.a = lineOffsetWidth/linePixelSize; // 线图层贴图部分的 v 坐标值
  1325. v_iconMapUV = a_iconMapUV;
  1326. }
  1327. gl_Position = project_common_position_to_clipspace(vec4(curr.xy + project_pixel(offset), curr.z * thetaOffset, 1.0));
  1328. // 地球模式
  1329. if(u_globel > 0.0) {
  1330. vec3 startLngLat = lglt2xyz(a_Instance.rg);
  1331. vec3 endLngLat = lglt2xyz(a_Instance.ba);
  1332. float globalRadius = length(startLngLat);
  1333. vec3 lineDir = normalize(endLngLat - startLngLat);
  1334. vec3 midPointDir = normalize((startLngLat + endLngLat)/2.0);
  1335. // 线的偏移
  1336. vec3 lnglatOffset = cross(lineDir, midPointDir) * a_Position.y;
  1337. // 计算起始点和终止点的距离
  1338. float lnglatLength = length(a_Instance.rg - a_Instance.ba)/50.0;
  1339. // 计算飞线各个节点相应的高度
  1340. float lineHeight = u_global_height * (-4.0*segmentRatio*segmentRatio + 4.0 * segmentRatio) * lnglatLength;
  1341. // 地球点位
  1342. vec3 globalPoint = normalize(mix(startLngLat, endLngLat, segmentRatio)) * (globalRadius + lineHeight) + lnglatOffset * a_Size;
  1343. gl_Position = u_ViewProjectionMatrix * vec4(globalPoint, 1.0);
  1344. }
  1345. setPickingColor(a_PickingColor);
  1346. }
  1347. `,dG={solid:0,dash:1};class qE extends Qt{constructor(...t){super(...t),E(this,"texture",void 0),E(this,"updateTexture",()=>{const{createTexture2D:r}=this.rendererService;if(this.texture){this.texture.update({data:this.iconService.getCanvas()}),this.layer.render();return}this.texture=r({data:this.iconService.getCanvas(),mag:m.NEAREST,min:m.NEAREST,premultiplyAlpha:!1,width:1024,height:this.iconService.canvasHeight||128}),this.textures=[this.texture]})}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,INSTANCE:10,INSTANCE_64LOW:11,UV:12,THETA_OFFSET:13})}getCommonUniformsInfo(){const{sourceColor:t,targetColor:r,textureBlend:n="normal",lineType:i="solid",dashArray:o=[10,5],lineTexture:a=!1,iconStep:s=100,segmentNumber:u=30,globalArcHeight:l=10}=this.layer.getLayerConfig(),{animateOption:f}=this.layer.getLayerConfig();o.length===2&&o.push(0,0);let c=0,h=[0,0,0,0],d=[0,0,0,0];if(t&&r&&(h=Zt(t),d=Zt(r),c=1),this.rendererService.getDirty()){var p;(p=this.texture)===null||p===void 0||p.bind()}const v={u_animate:this.animateOption2Array(f),u_dash_array:o,u_sourceColor:h,u_targetColor:d,u_textSize:[1024,this.iconService.canvasHeight||128],u_globel:this.mapService.version==="GLOBEL"?1:0,u_globel_radius:NS,u_global_height:l,segmentNumber:u,u_line_type:dG[i]||0,u_icon_step:s,u_line_texture:a?1:0,u_textureBlend:n==="normal"?0:1,u_time:this.layer.getLayerAnimateTime()||0,u_linearColor:c};return this.getUniformsBufferInfo(v)}initModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),t.updateTexture(),t.iconService.on("imageUpdate",t.updateTexture),t.buildModels()})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy(),this.iconService.off("imageUpdate",this.updateTexture)}getShaders(){return{frag:fG,vert:hG,type:""}}buildModels(){var t=this;return ve(function*(){const{segmentNumber:r=30}=t.layer.getLayerConfig(),{frag:n,vert:i,type:o}=t.getShaders();return[yield t.layer.buildLayerModel({moduleName:"lineArc3d"+o,vertexShader:i,fragmentShader:n,defines:t.getDefines(),inject:t.getInject(),triangulation:r_,styleOption:{segmentNumber:r}})]})()}registerBuiltinAttributes(){this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=1}=t;return Array.isArray(r)?[r[0]]:[r]}}}),this.styleAttributeService.registerStyleAttribute({name:"instance",type:qe.Attribute,descriptor:{name:"a_Instance",shaderLocation:this.attributeLocation.INSTANCE,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n)=>[n[3],n[4],n[5],n[6]]}}),this.styleAttributeService.registerStyleAttribute({name:"instance64Low",type:qe.Attribute,descriptor:{name:"a_Instance64Low",shaderLocation:this.attributeLocation.INSTANCE_64LOW,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n)=>[Ir(n[3]),Ir(n[4]),Ir(n[5]),Ir(n[6])]}}),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_iconMapUV",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const r=this.iconService.getIconMap(),{texture:n}=t,{x:i,y:o}=r[n]||{x:0,y:0};return[i,o]}}}),this.styleAttributeService.registerStyleAttribute({name:"thetaOffset",type:qe.Attribute,descriptor:{name:"a_ThetaOffset",shaderLocation:this.attributeLocation.THETA_OFFSET,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{thetaOffset:r=1}=t;return[r]}}})}}const KE={circle:2,triangle:2,diamond:4,rect:2,classic:3,halfTriangle:2,none:0},dn=1/2;function pG(e,t){const{width:r=2,height:n=1}=t;return{vertices:[0,dn*e,1*e*r,-(n+dn)*e,1*e*r,(n-dn)*e,0,dn*e,1*e*r,-(n+dn)*e,1*e*r,(n-dn)*e],indices:[3,4,5],outLineIndices:[0,1,2],normals:[1*e,-2*e,1,-2*e,1.5*e,1,1*e,1.5*e,1,0,0,0,0,0,0,0,0,0],dimensions:2}}function _G(e,t){const{width:r=2,height:n=3}=t;return{vertices:[0,0,1*e*r,1*n,1*e*r,-1*n,0,0,1*e*r,1*n,1*e*r,-1*n],outLineIndices:[0,1,2],indices:[
  1348. in vec4 v_color;
  1349. out vec4 outputColor;
  1350. // line texture
  1351. #pragma include "picking"
  1352. void main() {
  1353. outputColor = v_color;
  1354. outputColor = filterColor(outputColor);
  1355. }
  1356. `,bG=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  1357. layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
  1358. layout(location = ATTRIBUTE_LOCATION_SIZE) in vec2 a_Size;
  1359. layout(location = ATTRIBUTE_LOCATION_INSTANCE) in vec4 a_Instance;
  1360. layout(location = ATTRIBUTE_LOCATION_INSTANCE_64LOW) in vec4 a_Instance64Low;
  1361. layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;
  1362. layout(std140) uniform commonUniorm {
  1363. float u_gap_width: 1.0;
  1364. float u_stroke_width: 1.0;
  1365. float u_stroke_opacity: 1.0;
  1366. };
  1367. #pragma include "projection"
  1368. #pragma include "project"
  1369. #pragma include "picking"
  1370. out vec4 v_color;
  1371. vec2 project_pixel_offset(vec2 offsets) {
  1372. vec2 data = project_pixel(offsets);
  1373. return vec2(data.x, -data.y);
  1374. }
  1375. vec2 line_dir(vec2 target, vec2 source) {
  1376. return normalize(ProjectFlat(target) - ProjectFlat(source));
  1377. }
  1378. void main() {
  1379. // 透明度计算
  1380. vec2 source_world = a_Instance.rg; // 起点
  1381. vec2 target_world = a_Instance.ba; // 终点
  1382. vec2 flowlineDir = line_dir(target_world, source_world);
  1383. vec2 perpendicularDir = vec2(-flowlineDir.y, flowlineDir.x);
  1384. vec2 position = mix(source_world, target_world, a_Position.x);
  1385. vec2 position64Low = mix(a_Instance64Low.rg, a_Instance64Low.ba, a_Position.x);
  1386. float lengthCommon = length(
  1387. project_position(vec4(target_world, 0, 1)) - project_position(vec4(source_world, 0, 1))
  1388. );
  1389. vec2 offsetDistances = a_Size.x * project_pixel_offset(vec2(a_Position.y, a_Position.z)); // Mapbox || 高德
  1390. vec2 limitedOffsetDistances = clamp(
  1391. offsetDistances,
  1392. project_pixel(-lengthCommon * 0.2),
  1393. project_pixel(lengthCommon * 0.2)
  1394. );
  1395. float startOffsetCommon = project_pixel(offsets[0]);
  1396. float endOffsetCommon = project_pixel(offsets[1]);
  1397. float endpointOffset = mix(
  1398. clamp(startOffsetCommon, 0.0, lengthCommon * 0.2),
  1399. -clamp(endOffsetCommon, 0.0, lengthCommon * 0.2),
  1400. a_Position.x
  1401. );
  1402. vec2 normalsCommon = u_stroke_width * project_pixel_offset(vec2(a_Normal.x, a_Normal.y));
  1403. float gapCommon = -1. * project_pixel(u_gap_width);
  1404. vec3 offsetCommon = vec3(
  1405. flowlineDir * (limitedOffsetDistances[1] + normalsCommon.y + endpointOffset * 1.05) -
  1406. perpendicularDir * (limitedOffsetDistances[0] + gapCommon + normalsCommon.x),
  1407. 0.0
  1408. );
  1409. vec4 project_pos = project_position(vec4(position.xy, 0, 1.0), position64Low);
  1410. vec4 fillColor = vec4(a_Color.rgb, a_Color.a * opacity);
  1411. v_color = mix(fillColor, vec4(u_stroke.xyz, u_stroke.w * fillColor.w * u_stroke_opacity), a_Normal.z);
  1412. gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offsetCommon.xy, 0., 1.0));
  1413. setPickingColor(a_PickingColor);
  1414. }
  1415. `;class RG extends Qt{get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,INSTANCE:10,INSTANCE_64LOW:11,NORMAL:12})}getCommonUniformsInfo(){const{gapWidth:t=2,strokeWidth:r=1,strokeOpacity:n=1}=this.layer.getLayerConfig(),i={u_gap_width:t,u_stroke_width:r,u_stroke_opacity:n};return this.getUniformsBufferInfo(i)}initModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),t.buildModels()})()}buildModels(){var t=this;return ve(function*(){return[yield t.layer.buildLayerModel({moduleName:"flow_line",vertexShader:bG,fragmentShader:xG,defines:t.getDefines(),inject:t.getInject(),triangulation:AG,styleOption:t.layer.getLayerConfig().symbol,primitive:m.TRIANGLES,depth:{enable:!1},pick:!1})]})()}registerBuiltinAttributes(){this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const{size:r=1}=t;return Array.isArray(r)?[r[0],r[1]]:[r,0]}}}),this.styleAttributeService.registerStyleAttribute({name:"instance",type:qe.Attribute,descriptor:{name:"a_Instance",shaderLocation:this.attributeLocation.INSTANCE,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n)=>[n[3],n[4],n[5],n[6]]}}),this.styleAttributeService.registerStyleAttribute({name:"instance64Low",type:qe.Attribute,descriptor:{name:"a_Instance64Low",shaderLocation:this.attributeLocation.INSTANCE_64LOW,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n)=>[Ir(n[3]),Ir(n[4]),Ir(n[5]),Ir(n[6])]}}),this.styleAttributeService.registerStyleAttribute({name:"normal",type:qe.Attribute,descriptor:{name:"a_Normal",shaderLocation:this.attributeLocation.NORMAL,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n,i,o)=>o}})}}const CG=`#define LineTypeSolid 0.0
  1416. #define LineTypeDash 1.0
  1417. #define Animate 0.0
  1418. #define LineTexture 1.0
  1419. uniform sampler2D u_texture;
  1420. layout(std140) uniform commonUniorm {
  1421. vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
  1422. vec4 u_dash_array: [10.0, 5., 0, 0];
  1423. vec4 u_sourceColor;
  1424. vec4 u_targetColor;
  1425. vec2 u_textSize;
  1426. float segmentNumber;
  1427. float u_line_type: 0.0;
  1428. float u_icon_step: 100;
  1429. float u_line_texture: 0.0;
  1430. float u_textureBlend;
  1431. float u_time;
  1432. float u_linearColor: 0;
  1433. };
  1434. in vec4 v_dash_array;
  1435. in vec4 v_color;
  1436. in vec2 v_iconMapUV;
  1437. in vec4 v_line_data;
  1438. in float v_distance_ratio;
  1439. out vec4 outputColor;
  1440. #pragma include "picking"
  1441. #pragma include "project"
  1442. #pragma include "projection"
  1443. void main() {
  1444. float animateSpeed = 0.0;
  1445. float d_segmentIndex = v_line_data.g;
  1446. // 设置弧线的底色
  1447. if(u_linearColor == 1.0) { // 使用渐变颜色
  1448. outputColor = mix(u_sourceColor, u_targetColor, d_segmentIndex/segmentNumber);
  1449. outputColor.a *= v_color.a;
  1450. } else { // 使用 color 方法传入的颜色
  1451. outputColor = v_color;
  1452. }
  1453. // float blur = 1.- smoothstep(u_blur, 1., length(v_normal.xy));
  1454. // float blur = smoothstep(1.0, u_blur, length(v_normal.xy));
  1455. if(u_line_type == LineTypeDash) {
  1456. float dashLength = mod(v_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);
  1457. if(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z)) {
  1458. // 实线部分
  1459. } else {
  1460. // 虚线部分
  1461. discard;
  1462. };
  1463. }
  1464. // 设置弧线的动画模式
  1465. if(u_animate.x == Animate) {
  1466. animateSpeed = u_time / u_animate.y;
  1467. float alpha =1.0 - fract( mod(1.0- v_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + u_time / u_animate.y);
  1468. alpha = (alpha + u_animate.w -1.0) / u_animate.w;
  1469. alpha = smoothstep(0., 1., alpha);
  1470. outputColor.a *= alpha;
  1471. }
  1472. // 设置弧线的贴图
  1473. if(LineTexture == u_line_texture && u_line_type != LineTypeDash) {
  1474. float arcRadio = smoothstep( 0.0, 1.0, (d_segmentIndex / (segmentNumber - 1.0)));
  1475. // float arcRadio = d_segmentIndex / (segmentNumber - 1.0);
  1476. float count = v_line_data.b; // 贴图在弧线上重复的数量
  1477. float u = fract(arcRadio * count - animateSpeed * count);
  1478. // float u = fract(arcRadio * count - animateSpeed);
  1479. if(u_animate.x == Animate) {
  1480. u = outputColor.a/v_color.a;
  1481. }
  1482. float v = v_line_data.a; // 线图层贴图部分的 v 坐标值
  1483. vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;
  1484. vec4 pattern = texture(SAMPLER_2D(u_texture), uv);
  1485. // 设置贴图和底色的叠加模式
  1486. if(u_textureBlend == 0.0) { // normal
  1487. pattern.a = 0.0;
  1488. outputColor = filterColor(outputColor + pattern);
  1489. } else { // replace
  1490. pattern.a *= v_color.a;
  1491. if(outputColor.a <= 0.0) {
  1492. pattern.a = 0.0;
  1493. }
  1494. outputColor = filterColor(pattern);
  1495. }
  1496. } else {
  1497. outputColor = filterColor(outputColor);
  1498. }
  1499. // gl_FragColor = filterColor(gl_FragColor);
  1500. }
  1501. `,OG=`#define LineTypeSolid (0.0)
  1502. #define LineTypeDash (1.0)
  1503. #define Animate (0.0)
  1504. #define LineTexture (1.0)
  1505. layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  1506. layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
  1507. layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
  1508. layout(location = ATTRIBUTE_LOCATION_INSTANCE) in vec4 a_Instance;
  1509. layout(location = ATTRIBUTE_LOCATION_INSTANCE_64LOW) in vec4 a_Instance64Low;
  1510. layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV;
  1511. layout(std140) uniform commonUniorm {
  1512. vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
  1513. vec4 u_dash_array: [10.0, 5., 0, 0];
  1514. vec4 u_sourceColor;
  1515. vec4 u_targetColor;
  1516. vec2 u_textSize;
  1517. float segmentNumber;
  1518. float u_line_type: 0.0;
  1519. float u_icon_step: 100;
  1520. float u_line_texture: 0.0;
  1521. float u_textureBlend;
  1522. float u_time;
  1523. float u_linearColor: 0;
  1524. };
  1525. out vec4 v_dash_array;
  1526. out vec4 v_color;
  1527. out vec2 v_iconMapUV;
  1528. out vec4 v_line_data;
  1529. out float v_distance_ratio;
  1530. #pragma include "projection"
  1531. #pragma include "project"
  1532. #pragma include "picking"
  1533. float maps(float value, float start1, float stop1, float start2, float stop2) {
  1534. return start2 + (stop2 - start2) * ((value - start1) / (stop1 - start1));
  1535. }
  1536. float getSegmentRatio(float index) {
  1537. return index / (segmentNumber - 1.0);
  1538. }
  1539. float paraboloid(vec2 source, vec2 target, float ratio) {
  1540. vec2 x = mix(source, target, ratio);
  1541. vec2 center = mix(source, target, 0.5);
  1542. float dSourceCenter = distance(source, center);
  1543. float dXCenter = distance(x, center);
  1544. return (dSourceCenter + dXCenter) * (dSourceCenter - dXCenter);
  1545. }
  1546. vec3 getPos(vec2 source, vec2 target, float segmentRatio) {
  1547. float vertex_height = paraboloid(source, target, segmentRatio);
  1548. return vec3(mix(source, target, segmentRatio), sqrt(max(0.0, vertex_height)));
  1549. }
  1550. vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {
  1551. // normalized direction of the line
  1552. vec2 dir_screenspace = normalize(line_clipspace);
  1553. // rotate by 90 degrees
  1554. dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
  1555. vec2 offset = dir_screenspace * offset_direction * setPickingSize(a_Size) / 2.0;
  1556. return offset;
  1557. }
  1558. vec2 getNormal(vec2 line_clipspace, float offset_direction) {
  1559. // normalized direction of the line
  1560. vec2 dir_screenspace = normalize(line_clipspace);
  1561. // rotate by 90 degrees
  1562. dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);
  1563. return dir_screenspace.xy * sign(offset_direction);
  1564. }
  1565. float getAngularDist(vec2 source, vec2 target) {
  1566. vec2 delta = source - target;
  1567. vec2 sin_half_delta = sin(delta / 2.0);
  1568. float a =
  1569. sin_half_delta.y * sin_half_delta.y +
  1570. cos(source.y) * cos(target.y) * sin_half_delta.x * sin_half_delta.x;
  1571. return 2.0 * atan(sqrt(a), sqrt(1.0 - a));
  1572. }
  1573. vec2 midPoint(vec2 source, vec2 target) {
  1574. vec2 center = target - source;
  1575. float r = length(center);
  1576. float theta = atan(center.y, center.x);
  1577. float thetaOffset = 0.314;
  1578. float r2 = r / 2.0 / cos(thetaOffset);
  1579. float theta2 = theta + thetaOffset;
  1580. vec2 mid = vec2(r2 * cos(theta2) + source.x, r2 * sin(theta2) + source.y);
  1581. return mid;
  1582. }
  1583. float bezier3(vec3 arr, float t) {
  1584. float ut = 1.0 - t;
  1585. return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t;
  1586. }
  1587. vec2 interpolate(vec2 source, vec2 target, float angularDist, float t) {
  1588. if (abs(angularDist - PI) < 0.001) {
  1589. return (1.0 - t) * source + t * target;
  1590. }
  1591. float a = sin((1.0 - t) * angularDist) / sin(angularDist);
  1592. float b = sin(t * angularDist) / sin(angularDist);
  1593. vec2 sin_source = sin(source);
  1594. vec2 cos_source = cos(source);
  1595. vec2 sin_target = sin(target);
  1596. vec2 cos_target = cos(target);
  1597. float x = a * cos_source.y * cos_source.x + b * cos_target.y * cos_target.x;
  1598. float y = a * cos_source.y * sin_source.x + b * cos_target.y * sin_target.x;
  1599. float z = a * sin_source.y + b * sin_target.y;
  1600. return vec2(atan(y, x), atan(z, sqrt(x * x + y * y)));
  1601. }
  1602. void main() {
  1603. v_color = a_Color;
  1604. v_color.a = v_color.a * opacity;
  1605. vec2 source = radians(a_Instance.rg);
  1606. vec2 target = radians(a_Instance.ba);
  1607. float angularDist = getAngularDist(source, target);
  1608. float segmentIndex = a_Position.x;
  1609. float segmentRatio = getSegmentRatio(segmentIndex);
  1610. float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0));
  1611. if (u_line_type == LineTypeDash) {
  1612. v_distance_ratio = segmentIndex / segmentNumber;
  1613. float total_Distance = pixelDistance(source, target) / 2.0 * PI;
  1614. total_Distance = total_Distance * 16.0; // total_Distance*16.0 调整默认的效果
  1615. v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / total_Distance;
  1616. }
  1617. if (u_animate.x == Animate) {
  1618. v_distance_ratio = segmentIndex / segmentNumber;
  1619. }
  1620. float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir);
  1621. v_distance_ratio = segmentIndex / segmentNumber;
  1622. vec4 curr = project_position(vec4(degrees(interpolate(source, target, angularDist, segmentRatio)), 0.0, 1.0), a_Instance64Low.xy);
  1623. vec4 next = project_position(vec4(degrees(interpolate(source, target, angularDist, nextSegmentRatio)), 0.0, 1.0), a_Instance64Low.zw);
  1624. // v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y);
  1625. vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y));
  1626. // vec4 project_pos = project_position(vec4(curr.xy, 0, 1.0));
  1627. // gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, curr.z, 1.0));
  1628. v_line_data.g = a_Position.x; // 该顶点在弧线上的分段排序
  1629. if (LineTexture == u_line_texture) {
  1630. float d_arcDistrance = length(source - target);
  1631. d_arcDistrance = project_pixel(d_arcDistrance);
  1632. float d_pixelLen = project_pixel(u_icon_step) / 8.0;
  1633. v_line_data.b = floor(d_arcDistrance / d_pixelLen); // 贴图在弧线上重复的数量
  1634. float lineOffsetWidth = length(offset + offset * sign(a_Position.y)); // 线横向偏移的距离
  1635. float linePixelSize = project_pixel(a_Size); // 定点位置偏移,按地图等级缩放后的距离
  1636. v_line_data.a = lineOffsetWidth / linePixelSize; // 线图层贴图部分的 v 坐标值
  1637. v_iconMapUV = a_iconMapUV;
  1638. }
  1639. gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0));
  1640. setPickingColor(a_PickingColor);
  1641. }
  1642. `,IG={solid:0,dash:1};class MG extends Qt{constructor(...t){super(...t),E(this,"texture",void 0),E(this,"updateTexture",()=>{const{createTexture2D:r}=this.rendererService;if(this.texture){this.texture.update({data:this.iconService.getCanvas()}),this.layer.render();return}this.texture=r({data:this.iconService.getCanvas(),mag:m.NEAREST,min:m.NEAREST,premultiplyAlpha:!1,width:1024,height:this.iconService.canvasHeight||128}),this.textures=[this.texture]})}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,INSTANCE:10,INSTANCE_64LOW:11,UV:12})}getCommonUniformsInfo(){const{sourceColor:t,targetColor:r,textureBlend:n="normal",lineType:i="solid",dashArray:o=[10,5],lineTexture:a=!1,iconStep:s=100,segmentNumber:u=30}=this.layer.getLayerConfig(),{animateOption:l}=this.layer.getLayerConfig();if(o.length===2&&o.push(0,0),this.rendererService.getDirty()){var f;(f=this.texture)===null||f===void 0||f.bind()}let c=0,h=[0,0,0,0],d=[0,0,0,0];t&&r&&(h=Zt(t),d=Zt(r),c=1);let p=this.layer.getLayerAnimateTime();isNaN(p)&&(p=0);const v={u_animate:this.animateOption2Array(l),u_dash_array:o,u_sourceColor:h,u_targetColor:d,u_textSize:[1024,this.iconService.canvasHeight||128],segmentNumber:u,u_line_type:IG[i]||0,u_icon_step:s,u_line_texture:a?1:0,u_textureBlend:n==="normal"?0:1,u_time:p,u_linearColor:c};return this.getUniformsBufferInfo(v)}initModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),t.updateTexture(),t.iconService.on("imageUpdate",t.updateTexture),t.buildModels()})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy(),this.iconService.off("imageUpdate",this.updateTexture)}buildModels(){var t=this;return ve(function*(){const{segmentNumber:r=30}=t.layer.getLayerConfig();return[yield t.layer.buildLayerModel({moduleName:"lineGreatCircle",vertexShader:OG,fragmentShader:CG,triangulation:r_,styleOption:{segmentNumber:r},defines:t.getDefines(),inject:t.getInject(),depth:{enable:!1}})]})()}registerBuiltinAttributes(){this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=1}=t;return Array.isArray(r)?[r[0]]:[r]}}}),this.styleAttributeService.registerStyleAttribute({name:"instance",type:qe.Attribute,descriptor:{name:"a_Instance",shaderLocation:this.attributeLocation.INSTANCE,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n)=>[n[3],n[4],n[5],n[6]]}}),this.styleAttributeService.registerStyleAttribute({name:"instance64Low",type:qe.Attribute,descriptor:{name:"a_Instance64Low",shaderLocation:this.attributeLocation.INSTANCE_64LOW,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n)=>[Ir(n[3]),Ir(n[4]),Ir(n[5]),Ir(n[6])]}}),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_iconMapUV",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const r=this.iconService.getIconMap(),{texture:n}=t,{x:i,y:o}=r[n]||{x:0,y:0};return[i,o]}}})}}const NG=`// #extension GL_OES_standard_derivatives : enable
  1643. #define Animate 0.0
  1644. #define LineTexture 1.0
  1645. uniform sampler2D u_texture;
  1646. layout(std140) uniform commonUniorm {
  1647. vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
  1648. vec4 u_dash_array;
  1649. vec4 u_blur;
  1650. vec4 u_sourceColor;
  1651. vec4 u_targetColor;
  1652. vec2 u_textSize;
  1653. float u_icon_step: 100;
  1654. float u_heightfixed: 0.0;
  1655. float u_vertexScale: 1.0;
  1656. float u_raisingHeight: 0.0;
  1657. float u_strokeWidth: 0.0;
  1658. float u_textureBlend;
  1659. float u_line_texture;
  1660. float u_linearDir: 1.0;
  1661. float u_linearColor: 0;
  1662. float u_time;
  1663. };
  1664. in vec4 v_color;
  1665. in vec4 v_stroke;
  1666. // dash
  1667. in vec4 v_dash_array;
  1668. in float v_d_distance_ratio;
  1669. in vec2 v_iconMapUV;
  1670. in vec4 v_texture_data;
  1671. out vec4 outputColor;
  1672. #pragma include "picking"
  1673. // [animate, duration, interval, trailLength],
  1674. void main() {
  1675. if(u_dash_array!=vec4(0.0)){
  1676. float dashLength = mod(v_d_distance_ratio, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);
  1677. if(!(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z))) {
  1678. // 虚线部分
  1679. discard;
  1680. };
  1681. }
  1682. float animateSpeed = 0.0; // 运动速度
  1683. float d_distance_ratio = v_texture_data.r; // 当前点位距离占线总长的比例
  1684. if(u_linearDir < 1.0) {
  1685. d_distance_ratio = v_texture_data.a;
  1686. }
  1687. if(u_linearColor == 1.0) { // 使用渐变颜色
  1688. outputColor = mix(u_sourceColor, u_targetColor, d_distance_ratio);
  1689. outputColor.a *= v_color.a;
  1690. } else { // 使用 color 方法传入的颜色
  1691. outputColor = v_color;
  1692. }
  1693. // anti-alias
  1694. // float blur = 1.0 - smoothstep(u_blur, 1., length(v_normal.xy));
  1695. if(u_animate.x == Animate) {
  1696. animateSpeed = u_time / u_animate.y;
  1697. float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + animateSpeed);
  1698. alpha = (alpha + u_animate.w -1.0) / u_animate.w;
  1699. alpha = smoothstep(0., 1., alpha);
  1700. outputColor.a *= alpha;
  1701. }
  1702. if(u_line_texture == LineTexture) { // while load texture
  1703. float aDistance = v_texture_data.g; // 当前顶点的距离
  1704. float d_texPixelLen = v_texture_data.b; // 贴图的像素长度,根据地图层级缩放
  1705. float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);
  1706. float v = v_texture_data.a; // 线图层贴图部分的 v 坐标值
  1707. // v = max(smoothstep(0.95, 1.0, v), v);
  1708. vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;
  1709. vec4 pattern = texture(SAMPLER_2D(u_texture), uv);
  1710. if(u_textureBlend == 0.0) { // normal
  1711. pattern.a = 0.0;
  1712. outputColor += pattern;
  1713. } else { // replace
  1714. pattern.a *= v_color.a;
  1715. if(outputColor.a <= 0.0) {
  1716. pattern.a = 0.0;
  1717. }
  1718. outputColor = pattern;
  1719. }
  1720. }
  1721. float v = v_texture_data.a;
  1722. float strokeWidth = min(0.5, u_strokeWidth);
  1723. // 绘制 border
  1724. if(strokeWidth > 0.01) {
  1725. float borderOuterWidth = strokeWidth / 2.0;
  1726. if(v >= 1.0 - strokeWidth || v <= strokeWidth) {
  1727. if(v > strokeWidth) { // 外侧
  1728. float linear = smoothstep(0.0, 1.0, (v - (1.0 - strokeWidth))/strokeWidth);
  1729. // float linear = step(0.0, (v - (1.0 - borderWidth))/borderWidth);
  1730. outputColor.rgb = mix(outputColor.rgb, v_stroke.rgb, linear);
  1731. } else if(v <= strokeWidth) {
  1732. float linear = smoothstep(0.0, 1.0, v/strokeWidth);
  1733. outputColor.rgb = mix(v_stroke.rgb, outputColor.rgb, linear);
  1734. }
  1735. }
  1736. if(v < borderOuterWidth) {
  1737. outputColor.a = mix(0.0, outputColor.a, v/borderOuterWidth);
  1738. } else if(v > 1.0 - borderOuterWidth) {
  1739. outputColor.a = mix(outputColor.a, 0.0, (v - (1.0 - borderOuterWidth))/borderOuterWidth);
  1740. }
  1741. }
  1742. // blur
  1743. float blurV = v_texture_data.a;
  1744. if(blurV < 0.5) {
  1745. outputColor.a *= mix(u_blur.r, u_blur.g, blurV/0.5);
  1746. } else {
  1747. outputColor.a *= mix(u_blur.g, u_blur.b, (blurV - 0.5)/0.5);
  1748. }
  1749. outputColor = filterColor(outputColor);
  1750. }
  1751. `,PG=`#define Animate (0.0)
  1752. layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  1753. layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
  1754. layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
  1755. layout(location = ATTRIBUTE_LOCATION_SIZE) in vec2 a_Size;
  1756. layout(location = ATTRIBUTE_LOCATION_DISTANCE_INDEX) in vec3 a_DistanceAndIndexAndMiter;
  1757. layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec4 a_Normal_Total_Distance;
  1758. layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV;
  1759. layout(std140) uniform commonUniorm {
  1760. vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
  1761. vec4 u_dash_array;
  1762. vec4 u_blur;
  1763. vec4 u_sourceColor;
  1764. vec4 u_targetColor;
  1765. vec2 u_textSize;
  1766. float u_icon_step: 100;
  1767. float u_heightfixed: 0.0;
  1768. float u_vertexScale: 1.0;
  1769. float u_raisingHeight: 0.0;
  1770. float u_strokeWidth: 0.0;
  1771. float u_textureBlend;
  1772. float u_line_texture;
  1773. float u_linearDir: 1.0;
  1774. float u_linearColor: 0;
  1775. float u_time;
  1776. };
  1777. out vec4 v_color;
  1778. out vec4 v_stroke;
  1779. //dash
  1780. out vec4 v_dash_array;
  1781. out float v_d_distance_ratio;
  1782. // texV 线图层 - 贴图部分的 v 坐标(线的宽度方向)
  1783. out vec2 v_iconMapUV;
  1784. out vec4 v_texture_data;
  1785. #pragma include "projection"
  1786. #pragma include "picking"
  1787. void main() {
  1788. vec2 a_DistanceAndIndex = a_DistanceAndIndexAndMiter.xy;
  1789. float a_Miter = a_DistanceAndIndexAndMiter.z;
  1790. vec3 a_Normal = a_Normal_Total_Distance.xyz;
  1791. float a_Total_Distance = a_Normal_Total_Distance.w;
  1792. //dash输出
  1793. v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / a_Total_Distance;
  1794. v_d_distance_ratio = a_DistanceAndIndex.x / a_Total_Distance;
  1795. // cal style mapping - 数据纹理映射部分的计算
  1796. float d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
  1797. v_iconMapUV = a_iconMapUV;
  1798. d_texPixelLen = project_float_pixel(u_icon_step);
  1799. v_color = a_Color;
  1800. v_color.a *= opacity;
  1801. v_stroke = stroke;
  1802. vec3 size = a_Miter * setPickingSize(a_Size.x) * a_Normal;
  1803. vec2 offset = project_pixel(size.xy);
  1804. float lineDistance = a_DistanceAndIndex.x;
  1805. float currentLinePointRatio = lineDistance / a_Total_Distance;
  1806. float lineOffsetWidth = length(offset + offset * sign(a_Miter)); // 线横向偏移的距离(向两侧偏移的和)
  1807. float linePixelSize = project_pixel(a_Size.x) * 2.0; // 定点位置偏移,按地图等级缩放后的距离 单侧 * 2
  1808. float texV = lineOffsetWidth / linePixelSize; // 线图层贴图部分的 v 坐标值
  1809. v_texture_data = vec4(currentLinePointRatio, lineDistance, d_texPixelLen, texV);
  1810. // 设置数据集的参数
  1811. vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0), a_Position64Low);
  1812. // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, a_Size.y, 1.0));
  1813. float h = float(a_Position.z) * u_vertexScale; // 线顶点的高度 - 兼容不存在第三个数值的情况 vertex height
  1814. float lineHeight = a_Size.y; // size 第二个参数代表的高度 [linewidth, lineheight]
  1815. // 兼容 mapbox 在线高度上的效果表现基本一致
  1816. if (
  1817. u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
  1818. u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
  1819. ) {
  1820. // mapbox
  1821. // 保持高度相对不变
  1822. float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);
  1823. h *= mapboxZoomScale;
  1824. h += u_raisingHeight * mapboxZoomScale;
  1825. if (u_heightfixed > 0.0) {
  1826. lineHeight *= mapboxZoomScale;
  1827. }
  1828. }
  1829. gl_Position = project_common_position_to_clipspace(
  1830. vec4(project_pos.xy + offset, lineHeight + h, 1.0)
  1831. );
  1832. setPickingColor(a_PickingColor);
  1833. }
  1834. `;class BS extends Qt{constructor(...t){super(...t),E(this,"textureEventFlag",!1),E(this,"texture",this.createTexture2D({data:new Uint8Array([0,0,0,0]),width:1,height:1})),E(this,"updateTexture",()=>{const{createTexture2D:r}=this.rendererService;if(this.textures.length===0&&(this.textures=[this.texture]),this.texture){this.texture.update({data:this.iconService.getCanvas()}),this.layer.render();return}this.texture=r({data:this.iconService.getCanvas(),mag:m.NEAREST,min:m.NEAREST,premultiplyAlpha:!1,width:1024,height:this.iconService.canvasHeight||128})})}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,DISTANCE_INDEX:10,NORMAL:11,UV:12})}getCommonUniformsInfo(){const{sourceColor:t,targetColor:r,textureBlend:n="normal",lineType:i="solid",dashArray:o=[10,5,0,0],lineTexture:a=!1,iconStep:s=100,vertexHeightScale:u=20,strokeWidth:l=0,raisingHeight:f=0,heightfixed:c=!1,linearDir:h=kE.VERTICAL,blur:d=[1,1,1,0]}=this.layer.getLayerConfig();let p=o;if(i!=="dash"&&(p=[0,0,0,0]),p.length===2&&p.push(0,0),this.rendererService.getDirty()&&this.texture){var v;(v=this.texture)===null||v===void 0||v.bind()}const{animateOption:g}=this.layer.getLayerConfig();let y=0,S=[0,0,0,0],R=[0,0,0,0];t&&r&&(S=Zt(t),R=Zt(r),y=1);const x={u_animate:this.animateOption2Array(g),u_dash_array:p,u_blur:d,u_sourceColor:S,u_targetColor:R,u_textSize:[1024,this.iconService.canvasHeight||128],u_icon_step:s,u_heightfixed:Number(c),u_vertexScale:u,u_raisingHeight:Number(f),u_strokeWidth:l,u_textureBlend:n===WW.NORMAL?0:1,u_line_texture:a?1:0,u_linearDir:h===kE.VERTICAL?1:0,u_linearColor:y,u_time:this.layer.getLayerAnimateTime()||0};return this.getUniformsBufferInfo(x)}initModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),t.textureEventFlag||(t.textureEventFlag=!0,t.updateTexture(),t.iconService.on("imageUpdate",t.updateTexture)),t.buildModels()})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy(),this.iconService.off("imageUpdate",this.updateTexture)}buildModels(){var t=this;return ve(function*(){const{depth:r=!1}=t.layer.getLayerConfig(),{frag:n,vert:i,type:o}=t.getShaders();return t.layer.triangulation=qd,[yield t.layer.buildLayerModel({moduleName:"line"+o,vertexShader:i,fragmentShader:n,triangulation:qd,defines:t.getDefines(),inject:t.getInject(),depth:{enable:r}})]})()}getShaders(){return{frag:NG,vert:PG,type:""}}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"distanceAndIndex",type:qe.Attribute,descriptor:{name:"a_DistanceAndIndexAndMiter",shaderLocation:this.attributeLocation.DISTANCE_INDEX,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n,i,o,a)=>a===void 0?[n[3],10,n[4]]:[n[3],a,n[4]]}}),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const{size:r=1}=t;return Array.isArray(r)?[r[0],r[1]]:[r,0]}}}),this.styleAttributeService.registerStyleAttribute({name:"normal_total_distance",type:qe.Attribute,descriptor:{name:"a_Normal_Total_Distance",shaderLocation:this.attributeLocation.NORMAL,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n,i,o)=>[...o,n[5]]}}),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_iconMapUV",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const r=this.iconService.getIconMap(),{texture:n}=t,{x:i,y:o}=r[n]||{x:0,y:0};return[i,o]}}})}}const LG=`
  1835. layout(std140) uniform commonUniorm {
  1836. vec4 u_sourceColor;
  1837. vec4 u_targetColor;
  1838. vec4 u_dash_array;
  1839. float u_vertexScale: 1.0;
  1840. float u_linearColor: 0;
  1841. };
  1842. in float v_distanceScale;
  1843. in vec4 v_color;
  1844. //dash
  1845. in vec4 v_dash_array;
  1846. out vec4 outputColor;
  1847. void main() {
  1848. if(u_dash_array!=vec4(0.0)){
  1849. float dashLength = mod(v_distanceScale, v_dash_array.x + v_dash_array.y + v_dash_array.z + v_dash_array.w);
  1850. if(!(dashLength < v_dash_array.x || (dashLength > (v_dash_array.x + v_dash_array.y) && dashLength < v_dash_array.x + v_dash_array.y + v_dash_array.z))) {
  1851. // 虚线部分
  1852. discard;
  1853. };
  1854. }
  1855. if(u_linearColor==1.0){
  1856. outputColor = mix(u_sourceColor, u_targetColor, v_distanceScale);
  1857. outputColor.a *= v_color.a; // 全局透明度
  1858. }
  1859. else{
  1860. outputColor = v_color;
  1861. }
  1862. }
  1863. `,wG=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  1864. layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
  1865. layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
  1866. layout(location = ATTRIBUTE_LOCATION_SIZE) in vec4 a_SizeDistanceAndTotalDistance;
  1867. layout(std140) uniform commonUniorm {
  1868. vec4 u_sourceColor;
  1869. vec4 u_targetColor;
  1870. vec4 u_dash_array;
  1871. float u_vertexScale: 1.0;
  1872. float u_linearColor: 0;
  1873. };
  1874. #pragma include "projection"
  1875. #pragma include "picking"
  1876. out vec4 v_color;
  1877. out float v_distanceScale;
  1878. out vec4 v_dash_array;
  1879. void main() {
  1880. //dash输出
  1881. v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / a_SizeDistanceAndTotalDistance.a;
  1882. v_color = a_Color;
  1883. v_distanceScale = a_SizeDistanceAndTotalDistance.b / a_SizeDistanceAndTotalDistance.a;
  1884. v_color.a = v_color.a * opacity;
  1885. vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0), a_Position64Low);
  1886. float h = float(a_Position.z) * u_vertexScale; // 线顶点的高度 - 兼容不存在第三个数值的情况
  1887. float lineHeight = a_SizeDistanceAndTotalDistance.y;
  1888. // 兼容 mapbox 在线高度上的效果表现基本一致
  1889. if (
  1890. u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
  1891. u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
  1892. ) {
  1893. // 保持高度相对不变
  1894. h *= 2.0 / pow(2.0, 20.0 - u_Zoom);
  1895. }
  1896. gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, lineHeight + h, 1.0));
  1897. gl_PointSize = 10.0;
  1898. }
  1899. `;class FG extends Qt{get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9})}getCommonUniformsInfo(){const{sourceColor:t,targetColor:r,lineType:n="solid",dashArray:i=[10,5,0,0],vertexHeightScale:o=20}=this.layer.getLayerConfig();let a=i;n!=="dash"&&(a=[0,0,0,0]),a.length===2&&a.push(0,0);let s=0,u=[0,0,0,0],l=[0,0,0,0];t&&r&&(u=Zt(t),l=Zt(r),s=1);const f={u_sourceColor:u,u_targetColor:l,u_dash_array:a,u_vertexScale:o,u_linearColor:s};return this.getUniformsBufferInfo(f)}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}getShaders(){return{frag:LG,vert:wG,type:"lineSimpleNormal"}}buildModels(){var t=this;return ve(function*(){t.initUniformsBuffer();const{frag:r,vert:n,type:i}=t.getShaders();return[yield t.layer.buildLayerModel({moduleName:i,vertexShader:n,fragmentShader:r,triangulation:qW,defines:t.getDefines(),inject:t.getInject(),primitive:m.LINES,depth:{enable:!1},pick:!1})]})()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"sizeDistanceAndTotalDistance",type:qe.Attribute,descriptor:{name:"a_SizeDistanceAndTotalDistance",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:4,update:(t,r,n)=>{const{size:i=1}=t,o=Array.isArray(i)?[i[0],i[1]]:[i,0];return[o[0],o[1],n[3],n[5]]}}})}}const BG=`#define Animate 0.0
  1900. #define LineTexture 1.0
  1901. // line texture
  1902. uniform sampler2D u_texture;
  1903. layout(std140) uniform commonUniorm {
  1904. vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
  1905. vec4 u_sourceColor;
  1906. vec4 u_targetColor;
  1907. vec2 u_textSize;
  1908. float u_icon_step: 100;
  1909. float u_heightfixed;
  1910. float u_linearColor: 0;
  1911. float u_line_texture;
  1912. float u_textureBlend;
  1913. float u_iconStepCount;
  1914. float u_time;
  1915. };
  1916. in vec2 v_iconMapUV;
  1917. in vec4 v_color;
  1918. in float v_blur;
  1919. in vec4 v_dataset;
  1920. out vec4 outputColor;
  1921. #pragma include "picking"
  1922. void main() {
  1923. float animateSpeed = 0.0; // 运动速度
  1924. float d_distance_ratio = v_dataset.r; // 当前点位距离占线总长的比例
  1925. float v = v_dataset.a;
  1926. if(u_linearColor == 1.0) { // 使用渐变颜色
  1927. outputColor = mix(u_sourceColor, u_targetColor, v);
  1928. } else { // 使用 color 方法传入的颜色
  1929. outputColor = v_color;
  1930. }
  1931. outputColor.a *= v_color.a; // 全局透明度
  1932. if(u_animate.x == Animate) {
  1933. animateSpeed = u_time / u_animate.y;
  1934. float alpha =1.0 - fract( mod(1.0- d_distance_ratio, u_animate.z)* (1.0/ u_animate.z) + animateSpeed);
  1935. alpha = (alpha + u_animate.w -1.0) / u_animate.w;
  1936. alpha = smoothstep(0., 1., alpha);
  1937. outputColor.a *= alpha;
  1938. }
  1939. if(u_line_texture == LineTexture) { // while load texture
  1940. float aDistance = v_dataset.g; // 当前顶点的距离
  1941. float d_texPixelLen = v_dataset.b; // 贴图的像素长度,根据地图层级缩放
  1942. float u = fract(mod(aDistance, d_texPixelLen)/d_texPixelLen - animateSpeed);
  1943. float v = v_dataset.a; // 线图层贴图部分的 v 坐标值
  1944. // 计算纹理间隔 start
  1945. float flag = 0.0;
  1946. if(u > 1.0/u_iconStepCount) {
  1947. flag = 1.0;
  1948. }
  1949. u = fract(u*u_iconStepCount);
  1950. // 计算纹理间隔 end
  1951. vec2 uv= v_iconMapUV / u_textSize + vec2(u, v) / u_textSize * 64.;
  1952. vec4 pattern = texture(SAMPLER_2D(u_texture), uv);
  1953. // Tip: 判断纹理间隔
  1954. if(flag > 0.0) {
  1955. pattern = vec4(0.0);
  1956. }
  1957. if(u_textureBlend == 0.0) { // normal
  1958. pattern.a = 0.0;
  1959. outputColor = filterColor(outputColor + pattern);
  1960. } else { // replace
  1961. pattern.a *= v_color.a;
  1962. if(outputColor.a <= 0.0) {
  1963. pattern.a = 0.0;
  1964. }
  1965. outputColor = filterColor(pattern);
  1966. }
  1967. }
  1968. // blur - AA
  1969. if(v < v_blur) {
  1970. outputColor.a = mix(0.0, outputColor.a, v/v_blur);
  1971. } else if(v > 1.0 - v_blur) {
  1972. outputColor.a = mix(outputColor.a, 0.0, (v - (1.0 - v_blur))/v_blur);
  1973. }
  1974. outputColor = filterColor(outputColor);
  1975. }
  1976. `,DG=`#define Animate 0.0
  1977. layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  1978. layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
  1979. layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
  1980. layout(location = ATTRIBUTE_LOCATION_SIZE) in vec2 a_Size;
  1981. layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;
  1982. layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_iconMapUV;
  1983. layout(location = ATTRIBUTE_LOCATION_DISTANCE_MITER_TOTAL) in vec3 a_Distance_Total_Miter;
  1984. layout(std140) uniform commonUniorm {
  1985. vec4 u_animate: [ 1., 2., 1.0, 0.2 ];
  1986. vec4 u_sourceColor;
  1987. vec4 u_targetColor;
  1988. vec2 u_textSize;
  1989. float u_icon_step: 100;
  1990. float u_heightfixed;
  1991. float u_linearColor: 0;
  1992. float u_line_texture;
  1993. float u_textureBlend;
  1994. float u_iconStepCount;
  1995. float u_time;
  1996. };
  1997. // texV 线图层 - 贴图部分的 v 坐标(线的宽度方向)
  1998. out vec2 v_iconMapUV;
  1999. out vec4 v_color;
  2000. out float v_blur;
  2001. out vec4 v_dataset;
  2002. #pragma include "projection"
  2003. #pragma include "light"
  2004. #pragma include "picking"
  2005. void main() {
  2006. float a_Distance = a_Distance_Total_Miter.x;
  2007. float a_Miter = a_Distance_Total_Miter.y;
  2008. float a_Total_Distance = a_Distance_Total_Miter.z;
  2009. float d_distance_ratio; // 当前点位距离占线总长的比例
  2010. float d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
  2011. v_iconMapUV = a_iconMapUV;
  2012. if (u_heightfixed < 1.0) {
  2013. // 高度随 zoom 调整
  2014. d_texPixelLen = project_pixel(u_icon_step);
  2015. } else {
  2016. d_texPixelLen = u_icon_step;
  2017. }
  2018. if (u_animate.x == Animate || u_linearColor == 1.0) {
  2019. d_distance_ratio = a_Distance / a_Total_Distance;
  2020. }
  2021. float miter = (a_Miter + 1.0) / 2.0;
  2022. // 设置数据集的参数
  2023. v_dataset[0] = d_distance_ratio; // 当前点位距离占线总长的比例
  2024. v_dataset[1] = a_Distance; // 当前顶点的距离
  2025. v_dataset[2] = d_texPixelLen; // 贴图的像素长度,根据地图层级缩放
  2026. v_dataset[3] = miter; // 线图层贴图部分的 v 坐标值 0 - 1
  2027. vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0), a_Position64Low);
  2028. float originSize = a_Size.x; // 固定高度
  2029. if (u_heightfixed < 1.0) {
  2030. originSize = project_float_meter(a_Size.x); // 高度随 zoom 调整
  2031. }
  2032. float wallHeight = originSize * miter;
  2033. float lightWeight = calc_lighting(vec4(project_pos.xy, wallHeight, 1.0));
  2034. v_blur = min(project_float_pixel(2.0) / originSize, 0.05);
  2035. v_color = vec4(a_Color.rgb * lightWeight, a_Color.w * opacity);
  2036. // 兼容 mapbox 在线高度上的效果表现基本一致
  2037. if (
  2038. u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
  2039. u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
  2040. ) {
  2041. // mapbox
  2042. // 保持高度相对不变
  2043. float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);
  2044. if (u_heightfixed > 0.0) {
  2045. wallHeight *= mapboxZoomScale;
  2046. }
  2047. }
  2048. gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, wallHeight, 1.0));
  2049. setPickingColor(a_PickingColor);
  2050. }
  2051. `;class UG extends Qt{constructor(...t){super(...t),E(this,"texture",void 0),E(this,"updateTexture",()=>{const{createTexture2D:r}=this.rendererService;if(this.texture){this.texture.update({data:this.iconService.getCanvas()}),this.layer.render();return}this.texture=r({data:this.iconService.getCanvas(),mag:m.NEAREST,min:m.NEAREST,premultiplyAlpha:!1,width:1024,height:this.iconService.canvasHeight||128}),this.textures=[this.texture]})}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,NORMAL:12,UV:13,DISTANCE_MITER_TOTAL:15})}getCommonUniformsInfo(){const{sourceColor:t,targetColor:r,textureBlend:n="normal",heightfixed:i=!1,lineTexture:o=!1,iconStep:a=100,iconStepCount:s=1}=this.layer.getLayerConfig(),{animateOption:u}=this.layer.getLayerConfig();if(this.rendererService.getDirty()){var l;(l=this.texture)===null||l===void 0||l.bind()}let f=0,c=[0,0,0,0],h=[0,0,0,0];t&&r&&(c=Zt(t),h=Zt(r),f=1);const d={u_animate:this.animateOption2Array(u),u_sourceColor:c,u_targetColor:h,u_textSize:[1024,this.iconService.canvasHeight||128],u_icon_step:a,u_heightfixed:Number(i),u_linearColor:f,u_line_texture:o?1:0,u_textureBlend:n==="normal"?0:1,u_iconStepCount:s,u_time:this.layer.getLayerAnimateTime()||0};return this.getUniformsBufferInfo(d)}initModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),t.updateTexture(),t.iconService.on("imageUpdate",t.updateTexture),t.buildModels()})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy(),this.iconService.off("imageUpdate",this.updateTexture)}buildModels(){var t=this;return ve(function*(){return[yield t.layer.buildLayerModel({moduleName:"lineWall",vertexShader:DG,fragmentShader:BG,triangulation:qd,defines:t.getDefines(),inject:t.getInject(),depth:{enable:!1},blend:t.getBlend()})]})()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const{size:r=1}=t;return Array.isArray(r)?[r[0],r[1]]:[r,0]}}}),this.styleAttributeService.registerStyleAttribute({name:"normal",type:qe.Attribute,descriptor:{name:"a_Normal",shaderLocation:this.attributeLocation.NORMAL,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n,i,o)=>o}}),this.styleAttributeService.registerStyleAttribute({name:"distanceAndTotalAndMiter",type:qe.Attribute,descriptor:{name:"a_Distance_Total_Miter",shaderLocation:this.attributeLocation.DISTANCE_MITER_TOTAL,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n)=>[n[3],n[4],n[5]]}}),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_iconMapUV",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const r=this.iconService.getIconMap(),{texture:n}=t,{x:i,y:o}=r[n]||{x:0,y:0};return[i,o]}}})}}const kG={arc:cG,arc3d:qE,greatcircle:MG,wall:UG,line:BS,simple:FG,flowline:RG,earthArc3d:qE};class DS extends Ka{constructor(...t){super(...t),E(this,"type","LineLayer"),E(this,"enableShaderEncodeStyles",["stroke","offsets","opacity","thetaOffset"]),E(this,"arrowInsertCount",0),E(this,"defaultSourceConfig",{data:[{lng1:100,lat1:30,lng2:130,lat2:30}],options:{parser:{type:"json",x:"lng1",y:"lat1",x1:"lng2",y1:"lat2"}}})}buildModels(){var t=this;return ve(function*(){const r=t.getModelType();t.layerModel=new kG[r](t),yield t.initLayerModels()})()}getDefaultConfig(){const t=this.getModelType();return{line:{},linearline:{},simple:{},wall:{},arc3d:{blend:"additive"},arc:{blend:"additive"},greatcircle:{blend:"additive"},tileLine:{},earthArc3d:{},flowline:{},arrow:{}}[t]}getModelType(){var t;if(this.layerType)return this.layerType;const r=this.styleAttributeService.getLayerStyleAttribute("shape");return(r==null||(t=r.scale)===null||t===void 0?void 0:t.field)||"line"}processData(t){if(this.getModelType()!=="simple")return t;const r=[];return t.map(n=>{if(Array
  2052. layout(std140) uniform commonUniorm {
  2053. vec4 u_stroke_color;
  2054. float u_additive;
  2055. float u_stroke_opacity;
  2056. float u_stroke_width;
  2057. };
  2058. in vec4 v_color;
  2059. in float v_blur;
  2060. in float v_innerRadius;
  2061. out vec4 outputColor;
  2062. #pragma include "picking"
  2063. void main() {
  2064. vec2 center = vec2(0.5);
  2065. // Tip: 片元到中心点的距离 0 - 1
  2066. float fragmengTocenter = distance(center, gl_PointCoord) * 2.0;
  2067. // Tip: 片元的剪切成圆形
  2068. float circleClipOpacity = 1.0 - smoothstep(v_blur, 1.0, fragmengTocenter);
  2069. if(v_innerRadius < 0.99) {
  2070. // 当存在 stroke 且 stroke > 0.01
  2071. float blurWidth = (1.0 - v_blur)/2.0;
  2072. vec4 stroke = vec4(u_stroke_color.rgb, u_stroke_opacity);
  2073. if(fragmengTocenter > v_innerRadius + blurWidth) {
  2074. outputColor = stroke;
  2075. } else if(fragmengTocenter > v_innerRadius - blurWidth){
  2076. float mixR = (fragmengTocenter - (v_innerRadius - blurWidth)) / (blurWidth * 2.0);
  2077. outputColor = mix(v_color, stroke, mixR);
  2078. } else {
  2079. outputColor = v_color;
  2080. }
  2081. } else {
  2082. // 当不存在 stroke 或 stroke <= 0.01
  2083. outputColor = v_color;
  2084. }
  2085. outputColor = filterColor(outputColor);
  2086. if(u_additive > 0.0) {
  2087. outputColor *= circleClipOpacity;
  2088. } else {
  2089. outputColor.a *= circleClipOpacity;
  2090. }
  2091. }
  2092. `,zG=`
  2093. layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  2094. layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
  2095. layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
  2096. layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
  2097. layout(std140) uniform commonUniorm {
  2098. vec4 u_stroke_color;
  2099. float u_additive;
  2100. float u_stroke_opacity;
  2101. float u_stroke_width;
  2102. };
  2103. out vec4 v_color;
  2104. out float v_blur;
  2105. out float v_innerRadius;
  2106. #pragma include "projection"
  2107. #pragma include "picking"
  2108. #pragma include "project"
  2109. void main() {
  2110. v_color = vec4(a_Color.xyz, a_Color.w * opacity);
  2111. v_blur = 1.0 - max(2.0 / a_Size, 0.05);
  2112. v_innerRadius = max((a_Size - u_stroke_width) / a_Size, 0.0);
  2113. vec2 offset = project_pixel(u_offsets);
  2114. vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
  2115. gl_Position = project_common_position_to_clipspace(vec4(vec2(project_pos.xy+offset),project_pos.z,project_pos.w));
  2116. gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;
  2117. setPickingColor(a_PickingColor);
  2118. }
  2119. `;function e1(e){const t=e.coordinates;return{vertices:[...t],indices:[0],size:t.length}}class VG extends Qt{get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9})}getDefaultStyle(){return{blend:"additive"}}getCommonUniformsInfo(){const{blend:t,strokeOpacity:r=1,strokeWidth:n=0,stroke:i="#fff"}=this.layer.getLayerConfig(),o={u_stroke_color:Zt(i),u_additive:t==="additive"?1:0,u_stroke_opacity:r,u_stroke_width:n};return this.getUniformsBufferInfo(o)}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}buildModels(){var t=this;return ve(function*(){return t.layer.triangulation=e1,t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"pointSimple",vertexShader:zG,fragmentShader:$G,defines:t.getDefines(),inject:t.getInject(),triangulation:e1,depth:{enable:!1},primitive:m.POINTS})]})()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=1}=t;return Array.isArray(r)?[r[0]]:[r]}}})}}const HG=`precision highp float;
  2120. in vec4 v_color;
  2121. #pragma include "picking"
  2122. layout(std140) uniform commonUniform {
  2123. vec4 u_sourceColor;
  2124. vec4 u_targetColor;
  2125. float u_linearColor: 0;
  2126. float u_heightfixed: 0.0; // 默认不固定
  2127. float u_globel;
  2128. float u_r;
  2129. float u_pickLight: 0.0;
  2130. float u_opacitylinear: 0.0;
  2131. float u_opacitylinear_dir: 1.0;
  2132. float u_lightEnable: 1.0;
  2133. };
  2134. in float v_lightWeight;
  2135. in float v_barLinearZ;
  2136. out vec4 outputColor;
  2137. void main() {
  2138. outputColor = v_color;
  2139. // 开启透明度渐变
  2140. if(u_opacitylinear > 0.0) {
  2141. outputColor.a *= u_opacitylinear_dir > 0.0 ? (1.0 - v_barLinearZ): v_barLinearZ;
  2142. }
  2143. // picking
  2144. if(u_pickLight > 0.0) {
  2145. outputColor = filterColorAlpha(outputColor, v_lightWeight);
  2146. } else {
  2147. outputColor = filterColor(outputColor);
  2148. }
  2149. }
  2150. `,jG=`precision highp float;
  2151. #define pi 3.1415926535
  2152. #define ambientRatio 0.5
  2153. #define diffuseRatio 0.3
  2154. #define specularRatio 0.2
  2155. layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  2156. layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
  2157. layout(location = ATTRIBUTE_LOCATION_SIZE) in vec3 a_Size;
  2158. layout(location = ATTRIBUTE_LOCATION_POS) in vec3 a_Pos;
  2159. layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;
  2160. layout(std140) uniform commonUniform {
  2161. vec4 u_sourceColor;
  2162. vec4 u_targetColor;
  2163. float u_linearColor: 0;
  2164. float u_heightfixed: 0.0; // 默认不固定
  2165. float u_globel;
  2166. float u_r;
  2167. float u_pickLight: 0.0;
  2168. float u_opacitylinear: 0.0;
  2169. float u_opacitylinear_dir: 1.0;
  2170. float u_lightEnable: 1.0;
  2171. };
  2172. out vec4 v_color;
  2173. out float v_lightWeight;
  2174. out float v_barLinearZ;
  2175. // 用于将在顶点着色器中计算好的样式值传递给片元
  2176. #pragma include "projection"
  2177. #pragma include "light"
  2178. #pragma include "picking"
  2179. float getYRadian(float x, float z) {
  2180. if(x > 0.0 && z > 0.0) {
  2181. return atan(x/z);
  2182. } else if(x > 0.0 && z <= 0.0){
  2183. return atan(-z/x) + pi/2.0;
  2184. } else if(x <= 0.0 && z <= 0.0) {
  2185. return pi + atan(x/z); //atan(x/z) +
  2186. } else {
  2187. return atan(z/-x) + pi*3.0/2.0;
  2188. }
  2189. }
  2190. float getXRadian(float y, float r) {
  2191. return atan(y/r);
  2192. }
  2193. void main() {
  2194. // cal style mapping - 数据纹理映射部分的计算
  2195. vec3 size = a_Size * a_Position;
  2196. // a_Position.z 是在构建网格的时候传入的标准值 0 - 1,在插值器插值可以获取 0~1 线性渐变的值
  2197. v_barLinearZ = a_Position.z;
  2198. vec3 offset = size; // 控制圆柱体的大小 - 从标准单位圆柱体进行偏移
  2199. if(u_heightfixed < 1.0) { // 圆柱体不固定高度
  2200. //
  2201. } else {// 圆柱体固定高度 ( 处理 mapbox )
  2202. if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
  2203. offset *= 4.0/pow(2.0, 21.0 - u_Zoom);
  2204. }
  2205. }
  2206. vec4 project_pos = project_position(vec4(a_Pos.xy, 0., 1.0));
  2207. // u_r 控制圆柱的生长
  2208. vec4 pos = vec4(project_pos.xy + offset.xy, offset.z * u_r, 1.0);
  2209. // 圆柱光照效果
  2210. float lightWeight = 1.0;
  2211. if(u_lightEnable > 0.0) { // 取消三元表达式,增强健壮性
  2212. lightWeight = calc_lighting(pos);
  2213. }
  2214. v_lightWeight = lightWeight;
  2215. // 设置圆柱的底色
  2216. if(u_linearColor == 1.0) { // 使用渐变颜色
  2217. v_color = mix(u_sourceColor, u_targetColor, v_barLinearZ);
  2218. v_color.rgb *= lightWeight;
  2219. } else { // 使用 color 方法传入的颜色
  2220. v_color = a_Color;
  2221. }
  2222. v_color.a *= u_opacity;
  2223. // 在地球模式下,将原本垂直于 xy 平面的圆柱调整姿态到适应圆的角度
  2224. //旋转矩阵mx,创建绕x轴旋转矩阵
  2225. float r = sqrt(a_Pos.z*a_Pos.z + a_Pos.x*a_Pos.x);
  2226. float xRadian = getXRadian(a_Pos.y, r);
  2227. float xcos = cos(xRadian);//求解旋转角度余弦值
  2228. float xsin = sin(xRadian);//求解旋转角度正弦值
  2229. mat4 mx = mat4(
  2230. 1,0,0,0,
  2231. 0,xcos,-xsin,0,
  2232. 0,xsin,xcos,0,
  2233. 0,0,0,1);
  2234. //旋转矩阵my,创建绕y轴旋转矩阵
  2235. float yRadian = getYRadian(a_Pos.x, a_Pos.z);
  2236. float ycos = cos(yRadian);//求解旋转角度余弦值
  2237. float ysin = sin(yRadian);//求解旋转角度正弦值
  2238. mat4 my = mat4(
  2239. ycos,0,-ysin,0,
  2240. 0,1,0,0,
  2241. ysin,0,ycos,0,
  2242. 0,0,0,1);
  2243. gl_Position = u_ViewProjectionMatrix * vec4(( my * mx * vec4(a_Position * a_Size, 1.0)).xyz + a_Pos, 1.0);
  2244. setPickingColor(a_PickingColor);
  2245. }
  2246. `,{isNumber:XG}=Sr;let WG=class extends Qt{constructor(...t){super(...t),E(this,"raiseCount",0),E(this,"raiseRepeat",0)}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,POS:10,NORMAL:11})}getCommonUniformsInfo(){const{animateOption:t={enable:!1,speed:.01,repeat:!1},opacity:r=1,sourceColor:n,targetColor:i,pickLight:o=!1,heightfixed:a=!0,opacityLinear:s={enable:!1,dir:"up"},lightEnable:u=!0}=this.layer.getLayerConfig();let l=0,f=[0,0,0,0],c=[0,0,0,0];if(n&&i&&(f=Zt(n),c=Zt(i),l=1),this.raiseCount<1&&this.raiseRepeat>0&&t.enable){const{speed:p=.01}=t;this.raiseCount+=p,this.raiseCount>=1&&(this.raiseRepeat>1?(this.raiseCount=0,this.raiseRepeat--):this.raiseCount=1)}const h={u_sourceColor:f,u_targetColor:c,u_linearColor:l,u_pickLight:Number(o),u_heightfixed:Number(a),u_r:t.enable&&this.raiseRepeat>0?this.raiseCount:1,u_opacity:XG(r)?r:1,u_opacitylinear:Number(s.enable),u_opacitylinear_dir:s.dir==="up"?1:0,u_lightEnable:Number(u)};return this.getUniformsBufferInfo(h)}initModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),t.buildModels()})()}buildModels(){var t=this;return ve(function*(){const{animateOption:{repeat:r=1}}=t.layer.getLayerConfig();return t.raiseRepeat=r,[yield t.layer.buildLayerModel({moduleName:"pointEarthExtrude",vertexShader:jG,fragmentShader:HG,triangulation:wS,depth:{enable:!0},defines:t.getDefines(),inject:t.getInject(),cull:{enable:!0,face:m.FRONT},blend:t.getBlend()})]})()}registerBuiltinAttributes(){this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:3,update:t=>{const{size:r}=t;if(r){let n=[];return Array.isArray(r)&&(n=r.length===2?[r[0],r[0],r[1]]:r),Array.isArray(r)||(n=[r,r,r]),n}else return[2,2,2]}}}),this.styleAttributeService.registerStyleAttribute({name:"normal",type:qe.Attribute,descriptor:{name:"a_Normal",shaderLocation:this.attributeLocation.NORMAL,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n,i,o)=>o}}),this.styleAttributeService.registerStyleAttribute({name:"pos",type:qe.Attribute,descriptor:{name:"a_Pos",shaderLocation:this.attributeLocation.POS,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:3,update:t=>{const r=Ao(t.coordinates);return PS([r[0],r[1]])}}})}};const GG=`in vec4 v_data;
  2247. in vec4 v_color;
  2248. in float v_radius;
  2249. layout(std140) uniform commonUniform {
  2250. float u_additive;
  2251. float u_stroke_opacity : 1;
  2252. float u_stroke_width : 2;
  2253. float u_blur : 0.0;
  2254. };
  2255. #pragma include "sdf_2d"
  2256. #pragma include "picking"
  2257. out vec4 outputColor;
  2258. void main() {
  2259. int shape = int(floor(v_data.w + 0.5));
  2260. vec4 strokeColor = u_stroke == vec4(0.0) ? v_color : u_stroke;
  2261. lowp float antialiasblur = v_data.z;
  2262. float r = v_radius / (v_radius + u_stroke_width);
  2263. float outer_df;
  2264. float inner_df;
  2265. // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'
  2266. if (shape == 0) {
  2267. outer_df = sdCircle(v_data.xy, 1.0);
  2268. inner_df = sdCircle(v_data.xy, r);
  2269. } else if (shape == 1) {
  2270. outer_df = sdEquilateralTriangle(1.1 * v_data.xy);
  2271. inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);
  2272. } else if (shape == 2) {
  2273. outer_df = sdBox(v_data.xy, vec2(1.));
  2274. inner_df = sdBox(v_data.xy, vec2(r));
  2275. } else if (shape == 3) {
  2276. outer_df = sdPentagon(v_data.xy, 0.8);
  2277. inner_df = sdPentagon(v_data.xy, r * 0.8);
  2278. } else if (shape == 4) {
  2279. outer_df = sdHexagon(v_data.xy, 0.8);
  2280. inner_df = sdHexagon(v_data.xy, r * 0.8);
  2281. } else if (shape == 5) {
  2282. outer_df = sdOctogon(v_data.xy, 1.0);
  2283. inner_df = sdOctogon(v_data.xy, r);
  2284. } else if (shape == 6) {
  2285. outer_df = sdHexagram(v_data.xy, 0.52);
  2286. inner_df = sdHexagram(v_data.xy, r * 0.52);
  2287. } else if (shape == 7) {
  2288. outer_df = sdRhombus(v_data.xy, vec2(1.0));
  2289. inner_df = sdRhombus(v_data.xy, vec2(r));
  2290. } else if (shape == 8) {
  2291. outer_df = sdVesica(v_data.xy, 1.1, 0.8);
  2292. inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);
  2293. }
  2294. if(outer_df > antialiasblur + 0.018) discard;
  2295. float opacity_t = smoothstep(0.0, antialiasblur, outer_df);
  2296. float color_t = u_stroke_width < 0.01 ? 0.0 : smoothstep(
  2297. antialiasblur,
  2298. 0.0,
  2299. inner_df
  2300. );
  2301. if(u_stroke_width < 0.01) {
  2302. outputColor = vec4(v_color.rgb, v_color.a * u_opacity);
  2303. } else {
  2304. outputColor = mix(vec4(v_color.rgb, v_color.a * u_opacity), strokeColor * u_stroke_opacity, color_t);
  2305. }
  2306. if(u_additive > 0.0) {
  2307. outputColor *= opacity_t;
  2308. outputColor = filterColorAlpha(outputColor, outputColor.a);
  2309. } else {
  2310. outputColor.a *= opacity_t;
  2311. outputColor = filterColor(outputColor);
  2312. }
  2313. }
  2314. `,YG=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  2315. layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
  2316. layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
  2317. layout(location = ATTRIBUTE_LOCATION_SHAPE) in float a_Shape;
  2318. layout(location = ATTRIBUTE_LOCATION_EXTRUDE) in vec3 a_Extrude;
  2319. layout(std140) uniform commonUniform {
  2320. float u_additive;
  2321. float u_stroke_opacity : 1;
  2322. float u_stroke_width : 2;
  2323. float u_blur : 0.0;
  2324. };
  2325. out vec4 v_data;
  2326. out vec4 v_color;
  2327. out float v_radius;
  2328. #pragma include "projection"
  2329. #pragma include "picking"
  2330. void main() {
  2331. vec3 extrude = a_Extrude;
  2332. float shape_type = a_Shape;
  2333. /*
  2334. * setPickingSize 设置拾取大小
  2335. */
  2336. float newSize = setPickingSize(a_Size);
  2337. // float newSize = setPickingSize(a_Size) * 0.00001038445708445579;
  2338. // unpack color(vec2)
  2339. v_color = a_Color;
  2340. // radius(16-bit)
  2341. v_radius = newSize;
  2342. // anti-alias
  2343. // float antialiased_blur = -max(u_blur, antialiasblur);
  2344. float antialiasblur = -max(2.0 / u_DevicePixelRatio / newSize, u_blur);
  2345. // TODP: /abs(extrude.x) 是为了兼容地球模式
  2346. v_data = vec4(extrude.x/abs(extrude.x), extrude.y/abs(extrude.y), antialiasblur,shape_type);
  2347. gl_Position = u_ViewProjectionMatrix * vec4(a_Position + extrude * newSize * 0.1 + vec3(u_offsets,0.0), 1.0);
  2348. setPickingColor(a_PickingColor);
  2349. }
  2350. `;let ZG=class extends Qt{get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,SHAPE:10,EXTRUDE:11})}getCommonUniformsInfo(){const{strokeOpacity:t=1,strokeWidth:r=0,blend:n,blur:i=0}=this.layer.getLayerConfig();this.layer.getLayerConfig();const o={u_additive:n==="additive"?1:0,u_stroke_opacity:t,u_stroke_width:r,u_blur:i};return this.getUniformsBufferInfo(o)}initModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),t.buildModels()})()}buildModels(){var t=this;return ve(function*(){return t.layer.triangulation=YE,[yield t.layer.buildLayerModel({moduleName:"pointEarthFill",vertexShader:YG,fragmentShader:GG,triangulation:YE,defines:t.getDefines(),inject:t.getInject(),depth:{enable:!0},blend:t.getBlend()})]})()}animateOption2Array(t){return[t.enable?0:1,t.speed||1,t.rings||3,0]}registerBuiltinAttributes(){this.styleAttributeService.registerStyleAttribute({name:"extrude",type:qe.Attribute,descriptor:{name:"a_Extrude",shaderLocation:this.attributeLocation.EXTRUDE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n,i)=>{const[o,a,s]=n,u=Wn(0,0,1),l=Wn(o,0,s),f=o>=0?cg(u,l):Math.PI*2-cg(u,l),c=Math.PI*2-Math.asin(a/100),h=Up();cA(h,h,f),kp(h,h,c);const d=Wn(1,1,0);Ml(d,d,h),qs(d,d);const p=Wn(-1,1,0);Ml(p,p,h),qs(p,p);const v=Wn(-1,-1,0);Ml(v,v,h),qs(v,v);const g=Wn(1,-1,0);Ml(g,g,h),qs(g,g);const y=[...d,...p,...v,...g],S=i%4*3;return[y[S],y[S+1],y[S+2]]}}}),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=5}=t;return Array.isArray(r)?[r[0]]:[r]}}}),this.styleAttributeService.registerStyleAttribute({name:"shape",type:qe.Attribute,descriptor:{name:"a_Shape",shaderLocation:this.attributeLocation.SHAPE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{shape:r=2}=t;return[this.layer.getLayerConfig().shape2d.indexOf(r)]}}})}};const qG=`
  2351. in vec4 v_color;
  2352. in float v_lightWeight;
  2353. out vec4 outputColor;
  2354. layout(std140) uniform commonUniforms {
  2355. float u_pickLight;
  2356. float u_heightfixed;
  2357. float u_r;
  2358. float u_linearColor;
  2359. vec4 u_sourceColor;
  2360. vec4 u_targetColor;
  2361. float u_opacitylinear;
  2362. float u_opacitylinear_dir;
  2363. float u_lightEnable;
  2364. };
  2365. #pragma include "scene_uniforms"
  2366. #pragma include "picking"
  2367. void main() {
  2368. outputColor = v_color;
  2369. // 开启透明度渐变
  2370. // picking
  2371. if(u_pickLight > 0.0) {
  2372. outputColor = filterColorAlpha(outputColor, v_lightWeight);
  2373. } else {
  2374. outputColor = filterColor(outputColor);
  2375. }
  2376. }
  2377. `,KG=`#define pi (3.1415926535)
  2378. layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  2379. layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
  2380. layout(location = ATTRIBUTE_LOCATION_SIZE) in vec3 a_Size;
  2381. layout(location = ATTRIBUTE_LOCATION_EXTRUDE) in vec4 a_Extrude;
  2382. layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;
  2383. layout(std140) uniform commonUniforms {
  2384. float u_pickLight;
  2385. float u_heightfixed;
  2386. float u_r;
  2387. float u_linearColor;
  2388. vec4 u_sourceColor;
  2389. vec4 u_targetColor;
  2390. float u_opacitylinear;
  2391. float u_opacitylinear_dir;
  2392. float u_lightEnable;
  2393. };
  2394. out vec4 v_color;
  2395. out float v_lightWeight;
  2396. #pragma include "projection"
  2397. #pragma include "light"
  2398. #pragma include "picking"
  2399. float getYRadian(float x, float z) {
  2400. if (x > 0.0 && z > 0.0) {
  2401. return atan(x / z);
  2402. } else if (x > 0.0 && z <= 0.0) {
  2403. return atan(-z / x) + pi / 2.0;
  2404. } else if (x <= 0.0 && z <= 0.0) {
  2405. return pi + atan(x / z); //atan(x/z) +
  2406. } else {
  2407. return atan(z / -x) + pi * 3.0 / 2.0;
  2408. }
  2409. }
  2410. float getXRadian(float y, float r) {
  2411. return atan(y / r);
  2412. }
  2413. void main() {
  2414. vec3 size = a_Size * a_Position;
  2415. vec3 offset = size; // 控制圆柱体的大小 - 从标准单位圆柱体进行偏移
  2416. if (u_heightfixed < 1.0) {
  2417. // 圆柱体不固定高度
  2418. } else {
  2419. // 圆柱体固定高度 ( 处理 mapbox )
  2420. if (
  2421. u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
  2422. u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
  2423. ) {
  2424. offset *= 4.0 / pow(2.0, 21.0 - u_Zoom);
  2425. }
  2426. }
  2427. vec2 positions = a_Extrude.xy;
  2428. vec2 positions64Low = a_Extrude.zw;
  2429. vec4 project_pos = project_position(vec4(positions, 0.0, 1.0), positions64Low);
  2430. // u_r 控制圆柱的生长
  2431. vec4 pos = vec4(project_pos.xy + offset.xy, offset.z * u_r, 1.0);
  2432. // // 圆柱光照效果
  2433. float lightWeight = 1.0;
  2434. if (u_lightEnable > 0.0) {
  2435. // 取消三元表达式,增强健壮性
  2436. lightWeight = calc_lighting(pos);
  2437. }
  2438. v_lightWeight = lightWeight;
  2439. v_color = a_Color;
  2440. // 设置圆柱的底色
  2441. if (u_linearColor == 1.0) {
  2442. // 使用渐变颜色
  2443. v_color = mix(u_sourceColor, u_targetColor, a_Position.z);
  2444. v_color.a = v_color.a * opacity;
  2445. } else {
  2446. v_color = vec4(a_Color.rgb * lightWeight, a_Color.w * opacity);
  2447. }
  2448. if (u_opacitylinear > 0.0) {
  2449. v_color.a *= u_opacitylinear_dir > 0.0 ? 1.0 - a_Position.z : a_Position.z;
  2450. }
  2451. gl_Position = project_common_position_to_clipspace(pos);
  2452. setPickingColor(a_PickingColor);
  2453. }
  2454. `;let US=class extends Qt{constructor(...t){super(...t),E(this,"raiseCount",0),E(this,"raiseRepeat",0)}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,EXTRUDE:10,NORMAL:11})}getCommonUniformsInfo(){const{animateOption:t={enable:!1,speed:.01,repeat:!1},sourceColor:r,targetColor:n,pickLight:i=!1,heightfixed:o=!1,opacityLinear:a={enable:!1,dir:"up"},lightEnable:s=!0}=this.layer.getLayerConfig();let u=0,l=[0,0,0,0],f=[0,0,0,0];if(r&&n&&(l=Zt(r),f=Zt(n),u=1),this.raiseCount<1&&this.raiseRepeat>0&&t.enable){const{speed:d=.01}=t;this.raiseCount+=d,this.raiseCount>=1&&(this.raiseRepeat>1?(this.raiseCount=0,this.raiseRepeat--):this.raiseCount=1)}const c={u_pickLight:Number(i),u_heightfixed:Number(o),u_r:t.enable&&this.raiseRepeat>0?this.raiseCount:1,u_linearColor:u,u_sourceColor:l,u_targetColor:f,u_opacitylinear:Number(a.enable),u_opacitylinear_dir:a.dir==="up"?1:0,u_lightEnable:Number(s)};return this.getUniformsBufferInfo(c)}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}buildModels(){var t=this;return ve(function*(){const{depth:r=!0,animateOption:{repeat:n=1}}=t.layer.getLayerConfig();return t.raiseRepeat=n,t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"pointExtrude",vertexShader:KG,fragmentShader:qG,triangulation:wS,defines:t.getDefines(),inject:t.getInject(),cull:{enable:!0,face:m.FRONT},depth:{enable:r}})]})()}registerBuiltinAttributes(){this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:3,update:t=>{const{size:r}=t;if(r){let n=[];return Array.isArray(r)&&(n=r.length===2?[r[0],r[0],r[1]]:r),Array.isArray(r)||(n=[r,r,r]),n}else return[2,2,2]}}}),this.styleAttributeService.registerStyleAttribute({name:"normal",type:qe.Attribute,descriptor:{name:"a_Normal",shaderLocation:this.attributeLocation.NORMAL,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n,i,o)=>o}}),this.styleAttributeService.registerStyleAttribute({name:"extrude",type:qe.Attribute,descriptor:{name:"a_Extrude",shaderLocation:this.attributeLocation.EXTRUDE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:4,update:t=>{const r=Ao(t.coordinates);return[r[0],r[1],Ir(r[0]),Ir(r[1])]}}})}};const QG=`
  2455. layout(std140) uniform commonUniforms {
  2456. vec3 u_blur_height_fixed;
  2457. float u_stroke_width;
  2458. float u_additive;
  2459. float u_stroke_opacity;
  2460. float u_size_unit;
  2461. float u_time;
  2462. vec4 u_animate;
  2463. };
  2464. in vec4 v_color;
  2465. in vec4 v_stroke;
  2466. in vec4 v_data;
  2467. in float v_radius;
  2468. #pragma include "scene_uniforms"
  2469. #pragma include "sdf_2d"
  2470. #pragma include "picking"
  2471. out vec4 outputColor;
  2472. void main() {
  2473. int shape = int(floor(v_data.w + 0.5));
  2474. lowp float antialiasblur = v_data.z;
  2475. float r = v_radius / (v_radius + u_stroke_width);
  2476. float outer_df;
  2477. float inner_df;
  2478. // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'
  2479. if (shape == 0) {
  2480. outer_df = sdCircle(v_data.xy, 1.0);
  2481. inner_df = sdCircle(v_data.xy, r);
  2482. } else if (shape == 1) {
  2483. outer_df = sdEquilateralTriangle(1.1 * v_data.xy);
  2484. inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);
  2485. } else if (shape == 2) {
  2486. outer_df = sdBox(v_data.xy, vec2(1.));
  2487. inner_df = sdBox(v_data.xy, vec2(r));
  2488. } else if (shape == 3) {
  2489. outer_df = sdPentagon(v_data.xy, 0.8);
  2490. inner_df = sdPentagon(v_data.xy, r * 0.8);
  2491. } else if (shape == 4) {
  2492. outer_df = sdHexagon(v_data.xy, 0.8);
  2493. inner_df = sdHexagon(v_data.xy, r * 0.8);
  2494. } else if (shape == 5) {
  2495. outer_df = sdOctogon(v_data.xy, 1.0);
  2496. inner_df = sdOctogon(v_data.xy, r);
  2497. } else if (shape == 6) {
  2498. outer_df = sdHexagram(v_data.xy, 0.52);
  2499. inner_df = sdHexagram(v_data.xy, r * 0.52);
  2500. } else if (shape == 7) {
  2501. outer_df = sdRhombus(v_data.xy, vec2(1.0));
  2502. inner_df = sdRhombus(v_data.xy, vec2(r));
  2503. } else if (shape == 8) {
  2504. outer_df = sdVesica(v_data.xy, 1.1, 0.8);
  2505. inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);
  2506. }
  2507. float opacity_t = smoothstep(0.0, antialiasblur, outer_df);
  2508. float color_t = u_stroke_width < 0.01 ? 0.0 : smoothstep(
  2509. antialiasblur,
  2510. 0.0,
  2511. inner_df
  2512. );
  2513. float PI = 3.14159;
  2514. float N_RINGS = 3.0;
  2515. float FREQ = 1.0;
  2516. if(u_stroke_width < 0.01) {
  2517. outputColor = v_color;
  2518. } else {
  2519. outputColor = mix(v_color, v_stroke * u_stroke_opacity, color_t);
  2520. }
  2521. float intensity = 1.0;
  2522. if(u_time!=-1.0){
  2523. //wave相关逻辑
  2524. float d = length(v_data.xy);
  2525. if(d > 0.5) {
  2526. discard;
  2527. }
  2528. intensity = clamp(cos(d * PI), 0.0, 1.0) * clamp(cos(2.0 * PI * (d * 2.0 * u_animate.z - u_animate.y * u_time)), 0.0, 1.0);
  2529. }
  2530. if(u_additive > 0.0) {
  2531. outputColor *= opacity_t;
  2532. outputColor *= intensity;//wave
  2533. outputColor = filterColorAlpha(outputColor, outputColor.a);
  2534. } else {
  2535. outputColor.a *= opacity_t;
  2536. outputColor.a *= intensity;//wave
  2537. outputColor = filterColor(outputColor);
  2538. }
  2539. // 作为 mask 模板时需要丢弃透明的像素
  2540. if(outputColor.a < 0.01) {
  2541. discard;
  2542. }
  2543. }
  2544. `,JG=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  2545. layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
  2546. layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
  2547. layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
  2548. layout(location = ATTRIBUTE_LOCATION_SHAPE) in float a_Shape;
  2549. layout(location = ATTRIBUTE_LOCATION_EXTRUDE) in vec3 a_Extrude;
  2550. layout(std140) uniform commonUniforms {
  2551. vec3 u_blur_height_fixed;
  2552. float u_stroke_width;
  2553. float u_additive;
  2554. float u_stroke_opacity;
  2555. float u_size_unit;
  2556. float u_time;
  2557. vec4 u_animate;
  2558. };
  2559. out vec4 v_color;
  2560. out vec4 v_stroke;
  2561. out vec4 v_data;
  2562. out float v_radius;
  2563. #pragma include "projection"
  2564. #pragma include "picking"
  2565. #pragma include "rotation_2d"
  2566. void main() {
  2567. // 透明度计算
  2568. v_stroke = stroke;
  2569. vec3 extrude = a_Extrude;
  2570. float shape_type = a_Shape;
  2571. /*
  2572. * setPickingSize 设置拾取大小
  2573. * u_meter2coord 在等面积大小的时候设置单位
  2574. */
  2575. float newSize = setPickingSize(a_Size);
  2576. // float newSize = setPickingSize(a_Size) * 0.00001038445708445579;
  2577. // unpack color(vec2)
  2578. v_color = vec4(a_Color.xyz, a_Color.w * opacity);
  2579. if(u_size_unit == 1.0) {
  2580. newSize = newSize * u_PixelsPerMeter.z;
  2581. }
  2582. v_radius = newSize;
  2583. // anti-alias
  2584. // float antialiased_blur = -max(u_blur, antialiasblur);
  2585. float antialiasblur = -max(2.0 / u_DevicePixelRatio / newSize, u_blur_height_fixed.x);
  2586. vec2 offset = (extrude.xy * (newSize + u_stroke_width) + u_offsets);
  2587. offset = project_pixel(offset);
  2588. offset = rotate_matrix(offset,rotation);
  2589. // TODP: /abs(extrude.x) 是为了兼容地球模式
  2590. v_data = vec4(extrude.x/abs(extrude.x), extrude.y/abs(extrude.y), antialiasblur,shape_type);
  2591. vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0), a_Position64Low);
  2592. // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));
  2593. float raisingHeight = u_blur_height_fixed.y;
  2594. if(u_blur_height_fixed.z < 1.0) { // false
  2595. raisingHeight = project_pixel(u_blur_height_fixed.y);
  2596. } else {
  2597. if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
  2598. float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);
  2599. raisingHeight = u_blur_height_fixed.y * mapboxZoomScale;
  2600. }
  2601. }
  2602. gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0));
  2603. setPickingColor(a_PickingColor);
  2604. }
  2605. `;let kS=class extends Qt{get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,SHAPE:10,EXTRUDE:11})}getCommonUniformsInfo(){const{strokeOpacity:t=1,strokeWidth:r=0,blend:n,blur:i=0,raisingHeight:o=0,heightfixed:a=!1,unit:s="pixel"}=this.layer.getLayerConfig();let u=this.getAnimateUniforms().u_time;isNaN(u)&&(u=-1);const l={u_blur_height_fixed:[i,Number(o),Number(a)],u_stroke_width:r,u_additive:n==="additive"?1:0,u_stroke_opacity:t,u_size_unit:t_[s],u_time:u,u_animate:this.getAnimateUniforms().u_animate};return this.getUniformsBufferInfo(l)}getAnimateUniforms(){const{animateOption:t={enable:!1}}=this.layer.getLayerConfig();return{u_animate:this.animateOption2Array(t),u_time:this.layer.getLayerAnimateTime()}}getAttribute(){return this.styleAttributeService.createAttributesAndIndices(this.layer.getEncodedData(),To)}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}buildModels(){var t=this;return ve(function*(){const{frag:r,vert:n,type:i}=t.getShaders();return t.layer.triangulation=To,t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:i,vertexShader:n,fragmentShader:r,defines:t.getDefines(),inject:t.getInject(),triangulation:To,depth:{enable:!1}})]})()}getShaders(){return{frag:QG,vert:JG,type:"pointFill"}}animateOption2Array(t){return[t.enable?0:1,t.speed||1,t.rings||3,0]}registerBuiltinAttributes(){const t=this.layer.getLayerConfig().shape2d;this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"extrude",type:qe.Attribute,descriptor:{name:"a_Extrude",shaderLocation:this.attributeLocation.EXTRUDE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:3,update:(r,n,i,o)=>{const a=[1,1,0,-1,1,0,-1,-1,0,1,-1,0],s=o%4*3;return[a[s],a[s+1],a[s+2]]}}}),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:r=>{const{size:n=5}=r;return Array.isArray(n)?[n[0]]:[n]}}}),this.styleAttributeService.registerStyleAttribute({name:"shape",type:qe.Attribute,descriptor:{name:"a_Shape",shaderLocation:this.attributeLocation.SHAPE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:r=>{const{shape:n=2}=r;return[t.indexOf(n)]}}})}};const eY=`in vec2 v_uv;// 本身的 uv 坐标
  2606. in vec2 v_Iconuv;
  2607. in float v_opacity;
  2608. out vec4 outputColor;
  2609. uniform sampler2D u_texture;
  2610. layout(std140) uniform commonUniform {
  2611. vec2 u_textSize;
  2612. float u_heightfixed: 0.0;
  2613. float u_raisingHeight: 0.0;
  2614. float u_size_unit;
  2615. };
  2616. #pragma include "scene_uniforms"
  2617. #pragma include "sdf_2d"
  2618. #pragma include "picking"
  2619. void main() {
  2620. vec2 pos = v_Iconuv / u_textSize + v_uv / u_textSize * 64.;
  2621. outputColor = texture(SAMPLER_2D(u_texture), pos);
  2622. outputColor.a *= v_opacity;
  2623. outputColor = filterColor(outputColor);
  2624. }
  2625. `,tY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  2626. layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
  2627. layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
  2628. layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
  2629. layout(location = ATTRIBUTE_LOCATION_EXTRUDE) in vec3 a_Extrude;
  2630. layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
  2631. layout(std140) uniform commonUniform {
  2632. vec2 u_textSize;
  2633. float u_heightfixed;
  2634. float u_raisingHeight;
  2635. float u_size_unit;
  2636. };
  2637. out vec2 v_uv;
  2638. out vec2 v_Iconuv;
  2639. out float v_opacity;
  2640. #pragma include "projection"
  2641. #pragma include "picking"
  2642. #pragma include "rotation_2d"
  2643. void main() {
  2644. vec3 extrude = a_Extrude;
  2645. v_uv = (a_Extrude.xy + 1.0) / 2.0;
  2646. v_uv.y = 1.0 - v_uv.y;
  2647. v_Iconuv = a_Uv;
  2648. v_opacity = opacity;
  2649. float newSize = a_Size;
  2650. if (u_size_unit == 1.0) {
  2651. newSize = newSize * u_PixelsPerMeter.z;
  2652. }
  2653. // vec2 offset = (u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets);
  2654. vec2 offset = extrude.xy * newSize + offsets;
  2655. offset = rotate_matrix(offset, rotation);
  2656. offset = project_pixel(offset);
  2657. vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0), a_Position64Low);
  2658. gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));
  2659. setPickingColor(a_PickingColor);
  2660. }
  2661. `;class rY extends Qt{constructor(...t){super(...t),E(this,"meter2coord",1),E(this,"texture",void 0),E(this,"isMeter",!1),E(this,"radian",0),E(this,"updateTexture",()=>{const{createTexture2D:r}=this.rendererService;if(this.texture){this.texture.update({data:this.iconService.getCanvas(),mag:"linear",min:"linear mipmap nearest",mipmap:!0}),this.layerService.throttleRenderLayers();return}this.texture=r({data:this.iconService.getCanvas(),mag:m.LINEAR,min:m.LINEAR_MIPMAP_LINEAR,premultiplyAlpha:!1,width:1024,height:this.iconService.canvasHeight||128,mipmap:!0}),this.textures=[this.texture]})}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,EXTRUDE:10,UV:11})}getCommonUniformsInfo(){const{raisingHeight:t=0,heightfixed:r=!1,unit:n="pixel"}=this.layer.getLayerConfig();if(this.rendererService.getDirty()){var i;(i=this.texture)===null||i===void 0||i.bind()}const o={u_textSize:[1024,this.iconService.canvasHeight||128],u_heightfixed:Number(r),u_raisingHeight:Number(t),u_size_unit:t_[n]};return this.getUniformsBufferInfo(o)}getAttribute(){return this.styleAttributeService.createAttributesAndIndices(this.layer.getEncodedData(),To)}initModels(){var t=this;return ve(function*(){return t.iconService.on("imageUpdate",t.updateTexture),t.updateTexture(),t.buildModels()})()}buildModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"pointFillImage",vertexShader:tY,fragmentShader:eY,triangulation:To,depth:{enable:!1},defines:t.getDefines(),inject:t.getInject(),cull:{enable:!0,face:m.FRONT}})]})()}clearModels(){var t;this.iconService.off("imageUpdate",this.updateTexture),(t=this.texture)===null||t===void 0||t.destroy()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_Uv",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const r=this.iconService.getIconMap(),{shape:n}=t,{x:i,y:o}=r[n]||{x:-64,y:-64};return[i,o]}}}),this.styleAttributeService.registerStyleAttribute({name:"extrude",type:qe.Attribute,descriptor:{name:"a_Extrude",shaderLocation:this.attributeLocation.EXTRUDE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n,i)=>{const o=[1,1,0,-1,1,0,-1,-1,0,1,-1,0],a=i%4*3;return[o[a],o[a+1],o[a+2]]}}}),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=5}=t;return Array.isArray(r)?[r[0]]:[r]}}})}}const nY=`layout(std140) uniform commonUniforms {
  2662. vec2 u_textSize;
  2663. float u_raisingHeight;
  2664. float u_heightfixed;
  2665. };
  2666. uniform sampler2D u_texture;
  2667. in vec4 v_color;
  2668. in vec2 v_uv;
  2669. in float v_opacity;
  2670. #pragma include "picking"
  2671. out vec4 outputColor;
  2672. void main(){
  2673. vec2 pos = v_uv / u_textSize + gl_PointCoord / u_textSize * 64.;
  2674. vec4 textureColor;
  2675. // Y = 0.299R + 0.587G + 0.114B // 亮度提取
  2676. textureColor = texture(SAMPLER_2D(u_texture), pos);
  2677. // Tip: 去除边缘部分 mipmap 导致的混合变暗
  2678. float fragmengTocenter = distance(vec2(0.5), gl_PointCoord);
  2679. if(fragmengTocenter >= 0.5) {
  2680. float luma = 0.299 * textureColor.r + 0.587 * textureColor.g + 0.114 * textureColor.b;
  2681. textureColor.a *= luma;
  2682. }
  2683. if(all(lessThan(v_color, vec4(1.0+0.00001))) && all(greaterThan(v_color, vec4(1.0-0.00001))) || v_color==vec4(1.0)){
  2684. outputColor= textureColor;
  2685. }else {
  2686. outputColor= step(0.01, textureColor.z) * v_color;
  2687. }
  2688. outputColor.a *= v_opacity;
  2689. if (outputColor.a < 0.01) {
  2690. discard;
  2691. }
  2692. outputColor = filterColor(outputColor);
  2693. }
  2694. `,iY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  2695. layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
  2696. layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
  2697. layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
  2698. layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
  2699. layout(std140) uniform commonUniforms {
  2700. vec2 u_textSize;
  2701. float u_raisingHeight;
  2702. float u_heightfixed;
  2703. };
  2704. out vec4 v_color;
  2705. out vec2 v_uv;
  2706. out float v_opacity;
  2707. #pragma include "projection"
  2708. #pragma include "picking"
  2709. void main() {
  2710. // cal style mapping - 数据纹理映射部分的计算
  2711. v_color = a_Color;
  2712. v_opacity = opacity;
  2713. v_uv = a_Uv;
  2714. vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
  2715. vec2 offset = project_pixel(offsets);
  2716. float raisingHeight = u_raisingHeight;
  2717. if (u_heightfixed < 1.0) {
  2718. // false
  2719. raisingHeight = project_pixel(u_raisingHeight);
  2720. } else {
  2721. if (
  2722. u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
  2723. u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
  2724. ) {
  2725. float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);
  2726. raisingHeight = u_raisingHeight * mapboxZoomScale;
  2727. }
  2728. }
  2729. gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0));
  2730. gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio;
  2731. setPickingColor(a_PickingColor);
  2732. }
  2733. `;class $S extends Qt{constructor(...t){super(...t),E(this,"texture",void 0),E(this,"updateTexture",()=>{const{createTexture2D:r}=this.rendererService;if(this.texture){this.texture.update({data:this.iconService.getCanvas(),mag:"linear",min:"linear mipmap nearest",mipmap:!0}),setTimeout(()=>{this.layerService.throttleRenderLayers()});return}this.texture=r({data:this.iconService.getCanvas(),mag:m.LINEAR,min:m.LINEAR_MIPMAP_LINEAR,premultiplyAlpha:!1,width:1024,height:this.iconService.canvasHeight||128,mipmap:!0})})}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,UV:10})}getUninforms(){if(this.rendererService.getDirty()){var t;(t=this.texture)===null||t===void 0||t.bind()}const r=this.getCommonUniformsInfo(),n=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he({},r.uniformsOption),n.uniformsOption)}getCommonUniformsInfo(){const{raisingHeight:t=0,heightfixed:r=!1}=this.layer.getLayerConfig(),n={u_textSize:[1024,this.iconService.canvasHeight||128],u_raisingHeight:Number(t),u_heightfixed:Number(r),u_texture:this.texture};return this.textures=[this.texture],this.getUniformsBufferInfo(n)}initModels(){var t=this;return ve(function*(){return t.iconService.on("imageUpdate",t.updateTexture),t.updateTexture(),t.buildModels()})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy(),this.iconService.off("imageUpdate",this.updateTexture)}buildModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"pointImage",vertexShader:iY,fragmentShader:nY,triangulation:ZW,defines:t.getDefines(),inject:t.getInject(),depth:{enable:!1},primitive:m.POINTS})]})()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=5}=t;return Array.isArray(r)?[r[0]]:[r]}}}),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_Uv",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:t=>{const r=this.iconService.getIconMap(),{shape:n}=t,{x:i,y:o}=r[n]||{x:-64,y:-64};return[i,o]}}})}}const oY=`in vec4 v_color;
  2734. out vec4 outputColor;
  2735. void main() {
  2736. outputColor = v_color;
  2737. }`,aY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  2738. layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
  2739. layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
  2740. layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
  2741. layout(std140) uniform u_Common {
  2742. float u_size_scale;
  2743. };
  2744. out vec4 v_color;
  2745. #pragma include "projection"
  2746. #pragma include "project"
  2747. void main() {
  2748. v_color = vec4(a_Color.xyz, a_Color.w * opacity);
  2749. vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
  2750. gl_Position = project_common_position_to_clipspace(project_pos);
  2751. gl_PointSize = a_Size * u_size_scale * 2.0 * u_DevicePixelRatio;
  2752. }
  2753. `;function t1(e){const t=e.coordinates;return{vertices:[...t],indices:[0],size:t.length}}class zS extends Qt{get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9})}getDefaultStyle(){return{blend:"additive"}}getCommonUniformsInfo(){const t={u_size_scale:.5};return this.getUniformsBufferInfo(t)}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}buildModels(){var t=this;return ve(function*(){return t.layer.triangulation=t1,t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"pointNormal",vertexShader:aY,fragmentShader:oY,triangulation:t1,defines:t.getDefines(),inject:t.getInject(),depth:{enable:!1},primitive:m.POINTS,pick:!1})]})()}clearModels(){}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=1}=t;return Array.isArray(r)?[r[0]]:[r]}}})}}const sY=`
  2754. layout(std140) uniform commonUniorm{
  2755. float u_additive;
  2756. float u_size_unit;
  2757. float u_speed: 1.0;
  2758. float u_time;
  2759. };
  2760. in vec4 v_data;
  2761. in vec4 v_color;
  2762. in float v_radius;
  2763. in vec2 v_extrude;
  2764. #pragma include "sdf_2d"
  2765. #pragma include "picking"
  2766. out vec4 outputColor;
  2767. void main() {
  2768. lowp float antialiasblur = v_data.z;
  2769. float r = v_radius / (v_radius);
  2770. float outer_df = sdCircle(v_data.xy, 1.0);
  2771. float inner_df = sdCircle(v_data.xy, r);
  2772. float opacity_t = smoothstep(0.0, antialiasblur, outer_df);
  2773. outputColor = vec4(v_color.rgb, v_color.a);
  2774. if(u_additive > 0.0) {
  2775. outputColor *= opacity_t;
  2776. } else {
  2777. outputColor.a *= opacity_t;
  2778. }
  2779. if(outputColor.a > 0.0) {
  2780. outputColor = filterColor(outputColor);
  2781. }
  2782. vec2 extrude = v_extrude;
  2783. vec2 dir = normalize(extrude);
  2784. vec2 baseDir = vec2(1.0, 0.0);
  2785. float pi = 3.14159265359;
  2786. float flag = sign(dir.y);
  2787. float rades = dot(dir, baseDir);
  2788. float radar_v = (flag - 1.0) * -0.5 * acos(rades)/pi;
  2789. // simple AA
  2790. if(radar_v > 0.99) {
  2791. radar_v = 1.0 - (radar_v - 0.99)/0.01;
  2792. }
  2793. outputColor.a *= radar_v;
  2794. }
  2795. `,uY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  2796. layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
  2797. layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
  2798. layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
  2799. layout(location = ATTRIBUTE_LOCATION_EXTRUDE) in vec3 a_Extrude;
  2800. layout(std140) uniform commonUniorm {
  2801. float u_additive;
  2802. float u_size_unit;
  2803. float u_speed: 1.0;
  2804. float u_time;
  2805. };
  2806. out vec4 v_data;
  2807. out vec4 v_color;
  2808. out float v_radius;
  2809. out vec2 v_extrude;
  2810. #pragma include "projection"
  2811. #pragma include "picking"
  2812. void main() {
  2813. float newSize = setPickingSize(a_Size);
  2814. float time = u_time * u_speed;
  2815. mat2 rotateMatrix = mat2(
  2816. cos(time), sin(time),
  2817. -sin(time), cos(time)
  2818. );
  2819. v_extrude = rotateMatrix * a_Extrude.xy;
  2820. v_color = a_Color;
  2821. v_color.a *= opacity;
  2822. float blur = 0.0;
  2823. float antialiasblur = -max(2.0 / u_DevicePixelRatio / a_Size, blur);
  2824. if(u_size_unit == 1.) {
  2825. newSize = newSize * u_PixelsPerMeter.z;
  2826. }
  2827. v_radius = newSize;
  2828. vec2 offset = (a_Extrude.xy * (newSize));
  2829. offset = project_pixel(offset);
  2830. v_data = vec4(a_Extrude.x, a_Extrude.y, antialiasblur, -1.0);
  2831. vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0), a_Position64Low);
  2832. gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));
  2833. setPickingColor(a_PickingColor);
  2834. }
  2835. `;class lY extends Qt{get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,EXTRUDE:10})}getCommonUniformsInfo(){const{blend:t,speed:r=1,unit:n="pixel"}=this.layer.getLayerConfig(),i={u_additive:t==="additive"?1:0,u_size_unit:t_[n],u_speed:r,u_time:this.layer.getLayerAnimateTime()};return this.getUniformsBufferInfo(i)}getAnimateUniforms(){return{}}getAttribute(){return this.styleAttributeService.createAttributesAndIndices(this.layer.getEncodedData(),To)}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}buildModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"pointRadar",vertexShader:uY,fragmentShader:sY,triangulation:To,defines:t.getDefines(),inject:t.getInject(),depth:{enable:!1}})]})()}animateOption2Array(t){return[t.enable?0:1,t.speed||1,t.rings||3,0]}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"extrude",type:qe.Attribute,descriptor:{name:"a_Extrude",shaderLocation:this.attributeLocation.EXTRUDE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n,i)=>{const o=[1,1,0,-1,1,0,-1,-1,0,1,-1,0],a=i%4*3;return[o[a],o[a+1],o[a+2]]}}}),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{shaderLocation:this.attributeLocation.SIZE,name:"a_Size",buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=5}=t;return Array.isArray(r)?[r[0]]:[r]}}})}}class cY{constructor(t,r,n){E(this,"boxCells",[]),E(this,"xCellCount",void 0),E(this,"yCellCount",void 0),E(this,"boxKeys",void 0),E(this,"bboxes",void 0),E(this,"width",void 0),E(this,"height",void 0),E(this,"xScale",void 0),E(this,"yScale",void 0),E(this,"boxUid",void 0);const i=this.boxCells;this.xCellCount=Math.ceil(t/n),this.yCellCount=Math.ceil(r/n);for(let o=0;o<this.xCellCount*this.yCellCount;o++)i.push([]);this.boxKeys=[],this.bboxes=[],this.width=t,this.height=r,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/r,this.boxUid=0}insert(t,r,n,i,o){this.forEachCell(r,n,i,o,this.insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i),this.bboxes.push(o)}query(t,r,n,i,o){return this.queryHitTest(t,r,n,i,!1,o)}hitTest(t,r,n,i,o){return this.queryHitTest(t,r,n,i,!0,o)}insertBoxCell(t,r,n,i,o,a){this.boxCells[o].push(a)}queryHitTest(t,r,n,i,o,a){if(n<0||t>this.width||i<0||r>this.height)return o?!1:[];const s=[];if(t<=0&&r<=0&&this.width<=n&&this.height<=i){if(o)return!0;for(let l=0;l<this.boxKeys.length;l++)s.push({key:this.boxKeys[l],x1:this.bboxes[l*4],y1:this.bboxes[l*4+1],x2:this.bboxes[l*4+2],y2:this.bboxes[l*4+3]});return a?s.filter(a):s}const u={hitTest:o,seenUids:{box:{},circle:{}}};return this.forEachCell(t,r,n,i,this.queryCell,s,u,a),o?s.length>0:s}queryCell(t,r,n,i,o,a,s,u){const l=s.seenUids,f=this.boxCells[o];if(f!==null){const c=this.bboxes;for(const h of f)if(!l.box[h]){l.box[h]=!0;const d=h*4;if(t<=c[d+2]&&r<=c[d+3]&&n>=c[d+0]&&i>=c[d+1]&&(!u||u(this.boxKeys[h]))){if(s.hitTest)return a.push(!0),!0;a.push({key:this.boxKeys[h],x1:c[d],y1:c[d+1],x2:c[d+2],y2:c[d+3]})}}}return!1}forEachCell(t,r,n,i,o,a,s,u){const l=this.convertToXCellCoord(t),f=this.convertToYCellCoord(r),c=this.convertToXCellCoord(n),h=this.convertToYCellCoord(i);for(let d=l;d<=c;d++)for(let p=f;p<=h;p++){const v=this.xCellCount*p+d;if(o.call(this,t,r,n,i,v,a,s,u))return}}convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}}class fY{constructor(t,r){E(this,"width",void 0),E(this,"height",void 0),E(this,"grid",void 0),E(this,"viewportPadding",100),E(this,"screenRightBoundary",void 0),E(this,"screenBottomBoundary",void 0),E(this,"gridRightBoundary",void 0),E(this,"gridBottomBoundary",void 0),this.width=t,this.height=r,this.viewportPadding=Math.max(t,r),this.grid=new cY(t+this.viewportPadding,r+this.viewportPadd
  2836. `),l=[],f={positionedGlyphs:l,top:a[1],bottom:a[1],left:a[0],right:a[0],lineCount:u.length,text:e};return s?dY(f,t,u,r,n,i,o):hY(f,t,u,r,n,i,o),l.length?f:!1}function _Y(e,t=[0,0],r){const{positionedGlyphs:n=[]}=e,i=[];for(const o of n){const a=o.metrics,s=4,u=a.advance*o.scale/2,l=[0,0],f=[o.x+u+t[0],o.y+t[1]],c=(0-s)*o.scale-u+f[0],h=(0-s)*o.scale+f[1],d=c+a.width*o.scale,p=h+a.height*o.scale,v={x:c,y:h},g={x:d,y:h},y={x:c,y:p},S={x:d,y:p};i.push({tl:v,tr:g,bl:y,br:S,tex:a,glyphOffset:l})}return i}const r1=`#define SDF_PX 8.0
  2837. #define EDGE_GAMMA 0.105
  2838. #define FONT_SIZE 48.0
  2839. uniform sampler2D u_sdf_map;
  2840. layout(std140) uniform commonUniforms {
  2841. vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];
  2842. vec2 u_sdf_map_size;
  2843. float u_raisingHeight: 0.0;
  2844. float u_stroke_width : 2;
  2845. float u_gamma_scale : 0.5;
  2846. float u_halo_blur : 0.5;
  2847. };
  2848. in vec2 v_uv;
  2849. in float v_gamma_scale;
  2850. in vec4 v_color;
  2851. in vec4 v_stroke_color;
  2852. in float v_fontScale;
  2853. out vec4 outputColor;
  2854. #pragma include "picking"
  2855. void main() {
  2856. // get style data mapping
  2857. // get sdf from atlas
  2858. float dist = texture(SAMPLER_2D(u_sdf_map), v_uv).a;
  2859. lowp float buff = (6.0 - u_stroke_width / v_fontScale) / SDF_PX;
  2860. highp float gamma = (u_halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (v_fontScale * u_gamma_scale) / 1.0;
  2861. highp float gamma_scaled = gamma * v_gamma_scale;
  2862. highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);
  2863. outputColor = mix(v_color, v_stroke_color, smoothstep(0., 0.5, 1.- dist));
  2864. outputColor.a *= alpha;
  2865. // 作为 mask 模板时需要丢弃透明的像素
  2866. if (outputColor.a < 0.01) {
  2867. discard;
  2868. }
  2869. outputColor = filterColor(outputColor);
  2870. }
  2871. `,n1=`#define SDF_PX 8.0
  2872. #define EDGE_GAMMA 0.105
  2873. #define FONT_SIZE 24.0
  2874. layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  2875. layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
  2876. layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
  2877. layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
  2878. layout(location = ATTRIBUTE_LOCATION_TEXT_OFFSETS) in vec2 a_textOffsets;
  2879. layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_tex;
  2880. layout(std140) uniform commonUniforms {
  2881. vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];
  2882. vec2 u_sdf_map_size;
  2883. float u_raisingHeight: 0.0;
  2884. float u_stroke_width : 2;
  2885. float u_gamma_scale : 0.5;
  2886. float u_halo_blur : 0.5;
  2887. };
  2888. out vec2 v_uv;
  2889. out float v_gamma_scale;
  2890. out vec4 v_color;
  2891. out vec4 v_stroke_color;
  2892. out float v_fontScale;
  2893. #pragma include "projection"
  2894. #pragma include "picking"
  2895. #pragma include "rotation_2d"
  2896. void main() {
  2897. // cal style mapping - 数据纹理映射部分的计算
  2898. v_uv = a_tex / u_sdf_map_size;
  2899. v_color = vec4(a_Color.xyz, a_Color.w * opacity);
  2900. v_stroke_color = vec4(u_stroke_color.xyz, u_stroke_color.w * opacity);
  2901. // 文本缩放比例
  2902. float fontScale = a_Size / FONT_SIZE;
  2903. v_fontScale = fontScale;
  2904. vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
  2905. // vec4 projected_position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
  2906. vec2 offset = rotate_matrix(a_textOffsets,rotation);
  2907. // gl_Position = vec4(projected_position.xy / projected_position.w + rotation_matrix * a_textOffsets * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0);
  2908. float raiseHeight = u_raisingHeight;
  2909. if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
  2910. float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);
  2911. raiseHeight = u_raisingHeight * mapboxZoomScale;
  2912. }
  2913. vec4 projected_position = project_common_position_to_clipspace(vec4(project_pos.xyz + vec3(0.0, 0.0, raiseHeight), 1.0));
  2914. gl_Position = vec4(
  2915. projected_position.xy / projected_position.w + offset * fontScale / u_ViewportSize * 2.0 * u_DevicePixelRatio, 0.0, 1.0);
  2916. v_gamma_scale = gl_Position.w;
  2917. setPickingColor(a_PickingColor);
  2918. }
  2919. `,{isEqual:Us}=Sr;function i1(e){const t=this,r=e.id,n=[],i=[];if(!t.glyphInfoMap||!t.glyphInfoMap[r])return{vertices:[],indices:[],size:7};const o=t.glyphInfoMap[r].centroid,a=o.length===2?[o[0],o[1],0]:o;return t.glyphInfoMap[r].glyphQuads.forEach((s,u)=>{n.push(...a,s.tex.x,s.tex.y+s.tex.height,s.tl.x,s.tl.y,...a,s.tex.x+s.tex.width,s.tex.y+s.tex.height,s.tr.x,s.tr.y,...a,s.tex.x+s.tex.width,s.tex.y,s.br.x,s.br.y,...a,s.tex.x,s.tex.y,s.bl.x,s.bl.y),i.push(0+u*4,1+u*4,2+u*4,2+u*4,3+u*4,0+u*4)}),{vertices:n,indices:i,size:7}}class jS extends Qt{constructor(...t){var r;super(...t),r=this,E(this,"glyphInfo",void 0),E(this,"glyphInfoMap",{}),E(this,"rawEncodeData",void 0),E(this,"texture",void 0),E(this,"currentZoom",-1),E(this,"extent",void 0),E(this,"textureHeight",0),E(this,"textCount",0),E(this,"preTextStyle",{}),E(this,"mapping",ve(function*(){r.initGlyph(),r.updateTexture(),yield r.reBuildModel()}))}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,TEXT_OFFSETS:10,UV:11})}getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he(he({},t.uniformsOption),r.uniformsOption),{u_sdf_map:this.textures[0]})}getCommonUniformsInfo(){const{stroke:t="#fff",strokeWidth:r=0,halo:n=.5,gamma:i=2,raisingHeight:o=0}=this.layer.getLayerConfig(),a=this.getFontServiceMapping(),s=this.getFontServiceCanvas();a&&Object.keys(a).length!==this.textCount&&s&&(this.updateTexture(),this.textCount=Object.keys(a).length),this.preTextStyle=this.getTextStyle();const u={u_stroke_color:Zt(t),u_sdf_map_size:[(s==null?void 0:s.width)||1,(s==null?void 0:s.height)||1],u_raisingHeight:Number(o),u_stroke_width:r,u_gamma_scale:i,u_halo_blur:n};return this.getUniformsBufferInfo(u)}initModels(){var t=this;return ve(function*(){return t.bindEvent(),t.extent=t.textExtent(),t.rawEncodeData=t.layer.getEncodedData(),t.preTextStyle=t.getTextStyle(),t.initUniformsBuffer(),t.buildModels()})()}buildModels(){var t=this;return ve(function*(){const{textAllowOverlap:r=!1}=t.layer.getLayerConfig();return t.initGlyph(),t.updateTexture(),r||t.filterGlyphs(),[yield t.layer.buildLayerModel({moduleName:"pointText",vertexShader:n1,fragmentShader:r1,defines:t.getDefines(),inject:t.getInject(),triangulation:i1.bind(t),depth:{enable:!1}})]})()}needUpdate(){var t=this;return ve(function*(){const{textAllowOverlap:r=!1,textAnchor:n="center",textOffset:i,padding:o,fontFamily:a,fontWeight:s}=t.getTextStyle();if(!Us(o,t.preTextStyle.padding)||!Us(i,t.preTextStyle.textOffset)||!Us(n,t.preTextStyle.textAnchor)||!Us(a,t.preTextStyle.fontFamily)||!Us(s,t.preTextStyle.fontWeight))return yield t.mapping(),!0;if(r)return!1;const u=t.mapService.getZoom(),l=t.mapService.getBounds(),f=kT(t.extent,l);return Math.abs(t.currentZoom-u)>.5||!f||r!==t.preTextStyle.textAllowOverlap?(yield t.reBuildModel(),!0):!1})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy(),this.layer.off("remapping",this.mapping)}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"textOffsets",type:qe.Attribute,descriptor:{shaderLocation:this.attributeLocation.TEXT_OFFSETS,name:"a_textOffsets",buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:2,update:(t,r,n)=>[n[5],n[6]]}}),this.styleAttributeService.registerStyleAttribute({name:"textUv",type:qe.Attribute,descriptor:{name:"a_tex",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:(t,r,n)=>[n[3],n[4]]}}),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=12}=t;return Array.isArray(r)?[r[0]]:[r]}}})}bindEvent(){this.layer.isTileLayer||this.layer.on("remapping",this.mapping)}textExtent(){const t=this.mapService.getBounds();return Lp(t,.5)}initTextFont(){const{fontWeight:t,fontFamily:r}=this.getTextStyle(),n=this.
  2920. vec4 u_sourceColor;
  2921. vec4 u_targetColor;
  2922. float u_linearColor;
  2923. float u_topsurface;
  2924. float u_sidesurface;
  2925. float u_heightfixed; // 默认不固定
  2926. float u_raisingHeight;
  2927. };
  2928. in vec4 v_Color;
  2929. #pragma include "scene_uniforms"
  2930. #pragma include "picking"
  2931. out vec4 outputColor;
  2932. void main() {
  2933. // top face
  2934. if(u_topsurface < 1.0) {
  2935. discard;
  2936. }
  2937. outputColor = v_Color;
  2938. outputColor = filterColor(outputColor);
  2939. }
  2940. `,EY=`
  2941. layout(std140) uniform commonUniforms {
  2942. vec4 u_sourceColor;
  2943. vec4 u_targetColor;
  2944. float u_linearColor;
  2945. float u_topsurface;
  2946. float u_sidesurface;
  2947. float u_heightfixed; // 默认不固定
  2948. float u_raisingHeight;
  2949. };
  2950. in vec4 v_Color;
  2951. in vec3 v_uvs;
  2952. in vec2 v_texture_data;
  2953. out vec4 outputColor;
  2954. #pragma include "scene_uniforms"
  2955. #pragma include "picking"
  2956. void main() {
  2957. float isSide = v_texture_data.x;
  2958. float sidey = v_uvs[2];
  2959. float lightWeight = v_texture_data.y;
  2960. // Tip: 部分机型 GPU 计算精度兼容
  2961. if(isSide < 0.999) {
  2962. // side face
  2963. if(u_sidesurface < 1.0) {
  2964. discard;
  2965. }
  2966. if( u_linearColor == 1.0) {
  2967. // side use linear
  2968. vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);
  2969. linearColor.rgb *= lightWeight;
  2970. outputColor = linearColor;
  2971. } else {
  2972. // side notuse linear
  2973. outputColor = v_Color;
  2974. }
  2975. } else {
  2976. // top face
  2977. if(u_topsurface < 1.0) {
  2978. discard;
  2979. }
  2980. outputColor = v_Color;
  2981. }
  2982. outputColor = filterColorAlpha(outputColor, lightWeight);
  2983. }
  2984. `,yY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  2985. layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
  2986. layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
  2987. layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
  2988. layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;
  2989. layout(location = ATTRIBUTE_LOCATION_UV) in vec3 a_uvs;
  2990. layout(std140) uniform commonUniforms {
  2991. vec4 u_sourceColor;
  2992. vec4 u_targetColor;
  2993. float u_linearColor;
  2994. float u_topsurface;
  2995. float u_sidesurface;
  2996. float u_heightfixed; // 默认不固定
  2997. float u_raisingHeight;
  2998. };
  2999. out vec4 v_Color;
  3000. out vec3 v_uvs;
  3001. out vec2 v_texture_data;
  3002. #pragma include "projection"
  3003. #pragma include "light"
  3004. #pragma include "picking"
  3005. void main() {
  3006. v_uvs = a_uvs;
  3007. // cal style mapping - 数据纹理映射部分的计算
  3008. vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);
  3009. vec4 project_pos = project_position(pos, a_Position64Low);
  3010. if (u_heightfixed > 0.0) {
  3011. // 判断几何体是否固定高度
  3012. project_pos.z = a_Position.z * a_Size;
  3013. project_pos.z += u_raisingHeight;
  3014. if (
  3015. u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
  3016. u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
  3017. ) {
  3018. float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);
  3019. project_pos.z *= mapboxZoomScale;
  3020. project_pos.z += u_raisingHeight * mapboxZoomScale;
  3021. }
  3022. }
  3023. gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
  3024. float lightWeight = calc_lighting(project_pos);
  3025. v_texture_data = vec2(a_Position.z, lightWeight);
  3026. v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w * opacity);
  3027. setPickingColor(a_PickingColor);
  3028. }
  3029. `,TY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  3030. layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
  3031. layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
  3032. layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
  3033. layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;
  3034. layout(location = ATTRIBUTE_LOCATION_UV) in vec3 a_uvs;
  3035. layout(std140) uniform commonUniforms {
  3036. vec4 u_sourceColor;
  3037. vec4 u_targetColor;
  3038. float u_linearColor;
  3039. float u_topsurface;
  3040. float u_sidesurface;
  3041. float u_heightfixed; // 默认不固定
  3042. float u_raisingHeight;
  3043. };
  3044. out vec4 v_Color;
  3045. #pragma include "projection"
  3046. #pragma include "light"
  3047. #pragma include "picking"
  3048. void main() {
  3049. float isSide = a_Position.z;
  3050. float topU = a_uvs[0];
  3051. float topV = 1.0 - a_uvs[1];
  3052. float sidey = a_uvs[2];
  3053. vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);
  3054. vec4 project_pos = project_position(pos, a_Position64Low);
  3055. float lightWeight = calc_lighting(project_pos);
  3056. if (u_heightfixed > 0.0) {
  3057. // 判断几何体是否固定高度
  3058. project_pos.z = a_Position.z * a_Size;
  3059. project_pos.z += u_raisingHeight;
  3060. if (
  3061. u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
  3062. u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
  3063. ) {
  3064. float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);
  3065. project_pos.z *= mapboxZoomScale;
  3066. project_pos.z += u_raisingHeight * mapboxZoomScale;
  3067. }
  3068. }
  3069. gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
  3070. // Tip: 部分机型 GPU 计算精度兼容
  3071. if (isSide < 0.999) {
  3072. // side face
  3073. // if(u_sidesurface < 1.0) {
  3074. // discard;
  3075. // }
  3076. if (u_linearColor == 1.0) {
  3077. vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);
  3078. linearColor.rgb *= lightWeight;
  3079. v_Color = linearColor;
  3080. } else {
  3081. v_Color = a_Color;
  3082. }
  3083. } else {
  3084. v_Color = a_Color;
  3085. }
  3086. v_Color = vec4(v_Color.rgb * lightWeight, v_Color.w * opacity);
  3087. setPickingColor(a_PickingColor);
  3088. }
  3089. `,AY=`uniform sampler2D u_texture;
  3090. layout(std140) uniform commonUniforms {
  3091. vec4 u_sourceColor;
  3092. vec4 u_targetColor;
  3093. float u_linearColor;
  3094. float u_topsurface;
  3095. float u_sidesurface;
  3096. float u_heightfixed; // 默认不固定
  3097. float u_raisingHeight;
  3098. };
  3099. in vec4 v_Color;
  3100. in vec3 v_uvs;
  3101. in vec2 v_texture_data;
  3102. #pragma include "scene_uniforms"
  3103. #pragma include "picking"
  3104. out vec4 outputColor;
  3105. void main() {
  3106. float opacity = u_opacity;
  3107. float isSide = v_texture_data.x;
  3108. float lightWeight = v_texture_data.y;
  3109. float topU = v_uvs[0];
  3110. float topV = 1.0 - v_uvs[1];
  3111. float sidey = v_uvs[2];
  3112. outputColor = texture(SAMPLER_2D(u_texture), vec2(topU, topV));
  3113. // Tip: 部分机型 GPU 计算精度兼容
  3114. if (isSide < 0.999) {// 是否是边缘
  3115. // side face
  3116. if (u_sidesurface < 1.0) {
  3117. discard;
  3118. }
  3119. if (u_linearColor == 1.0) {
  3120. vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);
  3121. linearColor.rgb *= lightWeight;
  3122. outputColor = linearColor;
  3123. } else {
  3124. outputColor = v_Color;
  3125. }
  3126. } else {
  3127. // top face
  3128. if (u_topsurface < 1.0) {
  3129. discard;
  3130. }
  3131. }
  3132. outputColor.a *= opacity;
  3133. outputColor = filterColor(outputColor);
  3134. }
  3135. `,SY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  3136. layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
  3137. layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
  3138. layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
  3139. layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;
  3140. layout(location = ATTRIBUTE_LOCATION_UV) in vec3 a_uvs;
  3141. layout(std140) uniform commonUniforms {
  3142. vec4 u_sourceColor;
  3143. vec4 u_targetColor;
  3144. float u_linearColor;
  3145. float u_topsurface;
  3146. float u_sidesurface;
  3147. float u_heightfixed; // 默认不固定
  3148. float u_raisingHeight;
  3149. };
  3150. out vec4 v_Color;
  3151. out vec3 v_uvs;
  3152. out vec2 v_texture_data;
  3153. #pragma include "projection"
  3154. #pragma include "light"
  3155. #pragma include "picking"
  3156. void main() {
  3157. vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);
  3158. vec4 project_pos = project_position(pos, a_Position64Low);
  3159. float lightWeight = calc_lighting(project_pos);
  3160. v_uvs = a_uvs;
  3161. v_Color = a_Color;
  3162. v_Color.a *= opacity;
  3163. v_texture_data = vec2(a_Position.z, lightWeight);
  3164. if (u_heightfixed > 0.0) {
  3165. // 判断几何体是否固定高度
  3166. project_pos.z = a_Position.z * a_Size;
  3167. project_pos.z += u_raisingHeight;
  3168. if (
  3169. u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
  3170. u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
  3171. ) {
  3172. float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);
  3173. project_pos.z *= mapboxZoomScale;
  3174. project_pos.z += u_raisingHeight * mapboxZoomScale;
  3175. }
  3176. }
  3177. gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
  3178. setPickingColor(a_PickingColor);
  3179. }
  3180. `;class xY extends Qt{constructor(...t){super(...t),E(this,"texture",void 0)}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,NORMAL:10,UV:11})}getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he({},t.uniformsOption),r.uniformsOption)}getCommonUniformsInfo(){const{mapTexture:t,heightfixed:r=!1,raisingHeight:n=0,topsurface:i=!0,sidesurface:o=!0,sourceColor:a,targetColor:s}=this.layer.getLayerConfig();let u=0,l=[1,1,1,1],f=[1,1,1,1];a&&s&&(l=Zt(a),f=Zt(s),u=1);const c={u_sourceColor:l,u_targetColor:f,u_linearColor:u,u_topsurface:Number(i),u_sidesurface:Number(o),u_heightfixed:Number(r),u_raisingHeight:Number(n)};return t&&this.texture&&(c.u_texture=this.texture,this.textures=[this.texture]),this.getUniformsBufferInfo(c)}initModels(){var t=this;return ve(function*(){return yield t.loadTexture(),t.buildModels()})()}buildModels(){var t=this;return ve(function*(){const{frag:r,vert:n,type:i}=t.getShaders();return t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:i,vertexShader:n,fragmentShader:r,depth:{enable:!0},defines:t.getDefines(),inject:t.getInject(),triangulation:FS})]})()}getShaders(){const{pickLight:t,mapTexture:r}=this.layer.getLayerConfig();return r?{frag:AY,vert:SY,type:"polygonExtrudeTexture"}:t?{frag:EY,vert:yY,type:"polygonExtrudePickLight"}:{frag:gY,vert:TY,type:"polygonExtrude"}}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy(),this.textures=[]}registerBuiltinAttributes(){const t=this.layer.getSource().extent,r=t[2]-t[0],n=t[3]-t[1];this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"uvs",type:qe.Attribute,descriptor:{name:"a_uvs",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(i,o,a)=>{const s=a[0],u=a[1];return[(s-t[0])/r,(u-t[1])/n,a[4]]}}}),this.styleAttributeService.registerStyleAttribute({name:"normal",type:qe.Attribute,descriptor:{name:"a_Normal",shaderLocation:this.attributeLocation.NORMAL,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(i,o,a,s,u)=>u}}),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:i=>{const{size:o=10}=i;return Array.isArray(o)?[o[0]]:[o]}}})}loadTexture(){var t=this;return ve(function*(){const{mapTexture:r}=t.layer.getLayerConfig(),{createTexture2D:n}=t.rendererService;if(t.texture=n({height:1,width:1}),r){const i=yield mY(r);t.texture=n({data:i,width:i.width,height:i.height,wrapS:m.CLAMP_TO_EDGE,wrapT:m.CLAMP_TO_EDGE,min:m.LINEAR,mag:m.LINEAR})}})()}}const bY=`
  3181. in vec4 v_Color;
  3182. #pragma include "scene_uniforms"
  3183. #pragma include "picking"
  3184. out vec4 outputColor;
  3185. void main() {
  3186. outputColor = v_Color;
  3187. outputColor = filterColor(outputColor);
  3188. }
  3189. `,RY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  3190. layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
  3191. layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
  3192. layout(location = ATTRIBUTE_LOCATION_SIZE) in float a_Size;
  3193. layout(location = ATTRIBUTE_LOCATION_NORMAL) in vec3 a_Normal;
  3194. out vec4 v_Color;
  3195. #pragma include "projection"
  3196. #pragma include "light"
  3197. #pragma include "picking"
  3198. void main() {
  3199. vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size + (1.0 - a_Position.z) * extrusionBase, 1.0);
  3200. vec4 project_pos = project_position(pos, a_Position64Low);
  3201. float lightWeight = calc_lighting(project_pos);
  3202. v_Color = a_Color;
  3203. v_Color = vec4(v_Color.rgb * lightWeight, v_Color.w * opacity);
  3204. gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
  3205. setPickingColor(a_PickingColor);
  3206. }
  3207. `;class CY extends Qt{constructor(...t){super(...t),E(this,"texture",void 0)}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,SIZE:9,NORMAL:10,EXTRUSION_BASE:11})}getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he({},t.uniformsOption),r.uniformsOption)}getCommonUniformsInfo(){const t={};return this.getUniformsBufferInfo(t)}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}buildModels(){var t=this;return ve(function*(){const{frag:r,vert:n,type:i}=t.getShaders();return t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:i,vertexShader:n,fragmentShader:r,defines:t.getDefines(),inject:t.getInject(),triangulation:FS,depth:{enable:!0}})]})()}getShaders(){return{frag:bY,vert:RY,type:"polygonExtrude"}}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"normal",type:qe.Attribute,descriptor:{name:"a_Normal",shaderLocation:this.attributeLocation.NORMAL,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(t,r,n,i,o)=>o}}),this.styleAttributeService.registerStyleAttribute({name:"size",type:qe.Attribute,descriptor:{name:"a_Size",shaderLocation:this.attributeLocation.SIZE,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{size:r=10}=t;return Array.isArray(r)?[r[0]]:[r]}}}),this.styleAttributeService.registerStyleAttribute({name:"extrusionBase",type:qe.Attribute,descriptor:{name:"a_ExtrusionBase",shaderLocation:this.attributeLocation.EXTRUSION_BASE,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:1,update:t=>{const{extrusionBase:r=0}=t;return[r]}}})}}const OY=`in vec4 v_color;
  3208. #pragma include "scene_uniforms"
  3209. #pragma include "picking"
  3210. out vec4 outputColor;
  3211. void main() {
  3212. outputColor = v_color;
  3213. outputColor = filterColor(outputColor);
  3214. }
  3215. `,IY=`
  3216. layout(std140) uniform commonUniforms {
  3217. float u_raisingHeight;
  3218. float u_opacitylinear;
  3219. float u_dir;
  3220. };
  3221. in vec4 v_color;
  3222. in vec3 v_linear;
  3223. in vec2 v_pos;
  3224. out vec4 outputColor;
  3225. #pragma include "scene_uniforms"
  3226. #pragma include "picking"
  3227. void main() {
  3228. outputColor = v_color;
  3229. if (u_opacitylinear > 0.0) {
  3230. outputColor.a *= u_dir == 1.0 ? 1.0 - length(v_pos - v_linear.xy)/v_linear.z : length(v_pos - v_linear.xy)/v_linear.z;
  3231. }
  3232. outputColor = filterColor(outputColor);
  3233. }
  3234. `,MY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  3235. layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
  3236. layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
  3237. layout(location = ATTRIBUTE_LOCATION_LINEAR) in vec3 a_linear;
  3238. layout(std140) uniform commonUniforms {
  3239. float u_raisingHeight;
  3240. float u_opacitylinear;
  3241. float u_dir;
  3242. };
  3243. out vec4 v_color;
  3244. out vec3 v_linear;
  3245. out vec2 v_pos;
  3246. #pragma include "projection"
  3247. #pragma include "picking"
  3248. void main() {
  3249. if (u_opacitylinear > 0.0) {
  3250. v_linear = a_linear;
  3251. v_pos = a_Position.xy;
  3252. }
  3253. v_color = vec4(a_Color.xyz, a_Color.w * opacity);
  3254. vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
  3255. project_pos.z += u_raisingHeight;
  3256. if (u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
  3257. float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);
  3258. project_pos.z *= mapboxZoomScale;
  3259. project_pos.z += u_raisingHeight * mapboxZoomScale;
  3260. }
  3261. gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
  3262. setPickingColor(a_PickingColor);
  3263. }
  3264. `,NY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  3265. layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
  3266. layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
  3267. layout(std140) uniform commonUniforms {
  3268. float u_raisingHeight;
  3269. };
  3270. out vec4 v_color;
  3271. #pragma include "projection"
  3272. #pragma include "picking"
  3273. void main() {
  3274. // cal style mapping - 数据纹理映射部分的计算
  3275. v_color = vec4(a_Color.xyz, a_Color.w * opacity);
  3276. vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
  3277. project_pos.z += u_raisingHeight;
  3278. if (
  3279. u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT ||
  3280. u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET
  3281. ) {
  3282. float mapboxZoomScale = 4.0 / pow(2.0, 21.0 - u_Zoom);
  3283. project_pos.z *= mapboxZoomScale;
  3284. project_pos.z += u_raisingHeight * mapboxZoomScale;
  3285. }
  3286. gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
  3287. setPickingColor(a_PickingColor);
  3288. }
  3289. `;class PY extends Qt{get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,LINEAR:9})}getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he({},t.uniformsOption),r.uniformsOption)}getCommonUniformsInfo(){const{raisingHeight:t=0,opacityLinear:r={enable:!1,dir:"in"}}=this.layer.getLayerConfig(),n={u_raisingHeight:Number(t),u_opacitylinear:Number(r.enable),u_dir:r.dir==="in"?1:0};return this.getUniformsBufferInfo(n)}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}buildModels(){var t=this;return ve(function*(){const{frag:r,vert:n,triangulation:i,type:o}=t.getModelParams();return t.initUniformsBuffer(),t.layer.triangulation=i,[yield t.layer.buildLayerModel({moduleName:o,vertexShader:n,fragmentShader:r,defines:t.getDefines(),inject:t.getInject(),triangulation:i,primitive:m.TRIANGLES,depth:{enable:!1}})]})()}registerBuiltinAttributes(){this.registerPosition64LowAttribute();const{opacityLinear:t={enable:!1,dir:"in"}}=this.layer.getLayerConfig();t.enable&&this.styleAttributeService.registerStyleAttribute({name:"linear",type:qe.Attribute,descriptor:{name:"a_linear",shaderLocation:this.attributeLocation.LINEAR,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:3,update:(r,n,i)=>[i[3],i[4],i[5]]}})}getModelParams(){const{opacityLinear:t={enable:!1}}=this.layer.getLayerConfig();return t.enable?{frag:IY,vert:MY,type:"polygonLinear",triangulation:QW}:{frag:OY,vert:NY,type:"polygonFill",triangulation:ku}}}const LY=`
  3290. layout(std140) uniform commonUniforms {
  3291. vec4 u_watercolor;
  3292. vec4 u_watercolor2;
  3293. float u_time;
  3294. };
  3295. in vec2 v_uv;
  3296. in float v_opacity;
  3297. out vec4 outputColor;
  3298. float coast2water_fadedepth = 0.10;
  3299. float large_waveheight = .750; // change to adjust the "heavy" waves
  3300. float large_wavesize = 3.4; // factor to adjust the large wave size
  3301. float small_waveheight = 0.6; // change to adjust the small random waves
  3302. float small_wavesize = 0.5; // factor to ajust the small wave size
  3303. float water_softlight_fact = 15.; // range [1..200] (should be << smaller than glossy-fact)
  3304. float water_glossylight_fact= 120.; // range [1..200]
  3305. float particle_amount = 70.;
  3306. vec3 water_specularcolor = vec3(1.3, 1.3, 0.9); // specular Color (RGB) of the water-highlights
  3307. #define light vec3(-0., sin(u_time*0.5)*.5 + .35, 2.8) // position of the sun
  3308. uniform sampler2D u_texture1;
  3309. uniform sampler2D u_texture2;
  3310. uniform sampler2D u_texture3;
  3311. float hash( float n ) {
  3312. return fract(sin(n)*43758.5453123);
  3313. }
  3314. // 2d noise function
  3315. float noise1( in vec2 x ) {
  3316. vec2 p = floor(x);
  3317. vec2 f = smoothstep(0.0, 1.0, fract(x));
  3318. float n = p.x + p.y*57.0;
  3319. return mix(mix( hash(n+ 0.0), hash(n+ 1.0),f.x),
  3320. mix( hash(n+ 57.0), hash(n+ 58.0),f.x),f.y);
  3321. }
  3322. float noise(vec2 p) {
  3323. return texture(SAMPLER_2D(u_texture2),p*vec2(1./256.)).x;
  3324. }
  3325. vec4 highness(vec2 p) {
  3326. vec4 t = texture(SAMPLER_2D(u_texture1),fract(p));
  3327. float clipped = -2.0-smoothstep(3.,10.,t.a)*6.9-smoothstep(10.,100.,t.a)*89.9-smoothstep(0.,10000.,t.a)*10000.0;
  3328. return clamp(t, 0.0,3.0)+clamp(t/3.0-1.0, 0.0,1.0)+clamp(t/16.0-1.0, 0.0,1.0);
  3329. }
  3330. float height_map( vec2 p ) {
  3331. vec4 height=highness(p);
  3332. /*
  3333. height = -0.5+
  3334. 0.5*smoothstep(-100.,0.,-height)+
  3335. 2.75*smoothstep(0.,2.,height)+
  3336. 1.75*smoothstep(2.,4.,height)+
  3337. 2.75*smoothstep(4.,16.,height)+
  3338. 1.5*smoothstep(16.,1000.,height);
  3339. */
  3340. mat2 m = mat2( 0.9563*1.4, -0.2924*1.4, 0.2924*1.4, 0.9563*1.4 );
  3341. //p = p*6.;
  3342. float f = 0.6000*noise1( p ); p = m*p*1.1*6.;
  3343. f += 0.2500*noise( p ); p = m*p*1.32;
  3344. f += 0.1666*noise( p ); p = m*p*1.11;
  3345. f += 0.0834*noise( p ); p = m*p*1.12;
  3346. f += 0.0634*noise( p ); p = m*p*1.13;
  3347. f += 0.0444*noise( p ); p = m*p*1.14;
  3348. f += 0.0274*noise( p ); p = m*p*1.15;
  3349. f += 0.0134*noise( p ); p = m*p*1.16;
  3350. f += 0.0104*noise( p ); p = m*p*1.17;
  3351. f += 0.0084*noise( p );
  3352. f = .25*f+dot(height,vec4(-.03125,-.125,.25,.25))*.5;
  3353. const float FLAT_LEVEL = 0.92525;
  3354. //f = f*0.25+height*0.75;
  3355. if (f<FLAT_LEVEL)
  3356. f = f;
  3357. else
  3358. f = pow((f-FLAT_LEVEL)/(1.-FLAT_LEVEL), 2.)*(1.-FLAT_LEVEL)*2.0+FLAT_LEVEL; // makes a smooth coast-increase
  3359. return clamp(f, 0., 10.);
  3360. }
  3361. vec3 plasma_quintic( float x ) {
  3362. x = clamp( x, 0.0, 1.0);
  3363. vec4 x1 = vec4( 1.0, x, x * x, x * x * x ); // 1 x x2 x3
  3364. vec4 x2 = x1 * x1.w * x; // x4 x5 x6 x7
  3365. return vec3(
  3366. dot( x1.xyzw, vec4( +0.063861086, +1.992659096, -1.023901152, -0.490832805 ) ) + dot( x2.xy, vec2( +1.308442123, -0.914547012 ) ),
  3367. dot( x1.xyzw, vec4( +0.049718590, -0.791144343, +2.892305078, +0.811726816 ) ) + dot( x2.xy, vec2( -4.686502417, +2.717794514 ) ),
  3368. dot( x1.xyzw, vec4( +0.513275779, +1.580255060, -5.164414457, +4.559573646 ) ) + dot( x2.xy, vec2( -1.916810682, +0.570638854 ) ) );
  3369. }
  3370. vec4 color(vec2 p){
  3371. vec4 c1 = vec4(1.7,1.6,.9,1);
  3372. vec4 c2 = vec4(.2,.94,.1,1);
  3373. vec4 c3 = vec4(.3,.2,.0,1);
  3374. vec4 c4 = vec4(.99,.99,1.6,1);
  3375. vec4 v = highness(p);
  3376. float los = smoothstep(0.1,1.1,v.b);
  3377. float his = smoothstep(3.5,6.5,v.b);
  3378. float ces = smoothstep(1.,5.,v.a);
  3379. vec4 lo = mix(c1,c2,los);
  3380. vec4 hi = mix(c3,c4,his);
  3381. vec4 ce = mix(lo,hi,ces);
  3382. return vec4(plasma_quintic(ces),1).ragb;
  3383. }
  3384. vec3 terrain_map( vec2 p )
  3385. {
  3386. return color(p).rgb*0.75+0.25*vec3(0.7, .55, .4)+texture(SAMPLER_2D(u_texture3), fract(p*5.)).rgb*.5; // test-terrain is simply 'sandstone'
  3387. }
  3388. const mat2 m = mat2( 0.72, -1.60, 1.60, 0.72 );
  3389. float water_map( vec2 p, float height ) {
  3390. vec2 p2 = p*large_wavesize;
  3391. vec2 shift1 = 0.001*vec2( u_time*160.0*2.0, u_time*120.0*2.0 );
  3392. vec2 shift2 = 0.001*vec2( u_time*190.0*2.0, -u_time*130.0*2.0 );
  3393. // coarse crossing 'ocean' waves...
  3394. float f = 0.6000*noise( p );
  3395. f += 0.2500*noise( p*m );
  3396. f += 0.1666*noise( p*m*m );
  3397. float wave = sin(p2.x*0.622+p2.y*0.622+shift2.x*4.269)*large_waveheight*f*height*height ;
  3398. p *= small_wavesize;
  3399. f = 0.;
  3400. float amp = 1.0, s = .5;
  3401. for (int i=0; i<9; i++)
  3402. { p = m*p*.947; f -= amp*abs(sin((noise( p+shift1*s )-.5)*2.)); amp = amp*.59; s*=-1.329; }
  3403. return wave+f*small_waveheight;
  3404. }
  3405. float nautic(vec2 p) {
  3406. p *= 18.;
  3407. float f = 0.;
  3408. float amp = 1.0, s = .5;
  3409. for (int i=0; i<3; i++)
  3410. { p = m*p*1.2; f += amp*abs(smoothstep(0., 1., noise( p+u_time*s ))-.5); amp = amp*.5; s*=-1.227; }
  3411. return pow(1.-f, 5.);
  3412. }
  3413. float particles(vec2 p) {
  3414. p *= 200.;
  3415. float f = 0.;
  3416. float amp = 1.0, s = 1.5;
  3417. for (int i=0; i<3; i++)
  3418. { p = m*p*1.2; f += amp*noise( p+u_time*s ); amp = amp*.5; s*=-1.227; }
  3419. return pow(f*.35, 7.)*particle_amount;
  3420. }
  3421. float test_shadow( vec2 xy, float height) {
  3422. vec3 r0 = vec3(xy, height);
  3423. vec3 rd = normalize( light - r0 );
  3424. float hit = 1.0;
  3425. float t = 0.001;
  3426. for (int j=1; j<25; j++)
  3427. {
  3428. vec3 p = r0 + t*rd;
  3429. float h = height_map( p.xy );
  3430. float height_diff = p.z - h;
  3431. if (height_diff<0.0)
  3432. {
  3433. return 0.0;
  3434. }
  3435. t += 0.01+height_diff*.02;
  3436. hit = min(hit, 2.*height_diff/t); // soft shaddow
  3437. }
  3438. return hit;
  3439. }
  3440. vec3 CalcTerrain(vec2 uv, float height) {
  3441. vec3 col = terrain_map( uv );
  3442. vec2 iResolution = vec2(512.);
  3443. float h1 = height_map(uv-vec2(0., 0.5)/ iResolution.xy);
  3444. float h2 = height_map(uv+vec2(0., 0.5)/ iResolution.xy);
  3445. float h3 = height_map(uv-vec2(0.5, 0.)/ iResolution.xy);
  3446. float h4 = height_map(uv+vec2(0.5, 0.)/ iResolution.xy);
  3447. vec3 norm = normalize(vec3(h3-h4, h1-h2, 1.));
  3448. vec3 r0 = vec3(uv, height);
  3449. vec3 rd = normalize( light - r0 );
  3450. float grad = dot(norm, rd);
  3451. col *= grad+pow(grad, 8.);
  3452. float terrainshade = test_shadow( uv, height );
  3453. col = mix(col*.25, col, terrainshade);
  3454. return col;
  3455. }
  3456. void main() {
  3457. vec3 watercolor = u_watercolor.rgb;
  3458. vec3 watercolor2 = u_watercolor2.rgb;
  3459. vec2 uv = v_uv;
  3460. float WATER_LEVEL = 0.84; // Water level (range: 0.0 - 2.0)
  3461. float deepwater_fadedepth = 0.4 + coast2water_fadedepth;
  3462. float height = height_map( uv );
  3463. vec3 col;
  3464. float waveheight = clamp(WATER_LEVEL*3.-1.5, 0., 1.);
  3465. float level = WATER_LEVEL + .2*water_map(uv*15. + vec2(u_time*.1), waveheight);
  3466. if (height > level)
  3467. {
  3468. col = CalcTerrain(uv, height);
  3469. }
  3470. if (height <= level)
  3471. {
  3472. vec2 dif = vec2(.0, .01);
  3473. vec2 pos = uv*15. + vec2(u_time*.01);
  3474. float h1 = water_map(pos-dif,waveheight);
  3475. float h2 = water_map(pos+dif,waveheight);
  3476. float h3 = water_map(pos-dif.yx,waveheight);
  3477. float h4 = water_map(pos+dif.yx,waveheight);
  3478. vec3 normwater = normalize(vec3(h3-h4, h1-h2, .125)); // norm-vector of the 'bumpy' water-plane
  3479. uv += normwater.xy*.002*(level-height);
  3480. col = CalcTerrain(uv, height);
  3481. float coastfade = clamp((level-height)/coast2water_fadedepth, 0., 1.);
  3482. float coastfade2= clamp((level-height)/deepwater_fadedepth, 0., 1.);
  3483. float intensity = col.r*.2126+col.g*.7152+col.b*.0722;
  3484. watercolor = mix(watercolor*intensity, watercolor2, smoothstep(0., 1., coastfade2));
  3485. vec3 r0 = vec3(uv, WATER_LEVEL);
  3486. vec3 rd = normalize( light - r0 ); // ray-direction to the light from water-position
  3487. float grad = dot(normwater, rd); // dot-product of norm-vector and light-direction
  3488. float specular = pow(grad, water_softlight_fact); // used for soft highlights
  3489. float specular2= pow(grad, water_glossylight_fact); // used for glossy highlights
  3490. float gradpos = dot(vec3(0., 0., 1.), rd);
  3491. float specular1= smoothstep(0., 1., pow(gradpos, 5.)); // used for diffusity (some darker corona around light's specular reflections...)
  3492. float watershade = test_shadow( uv, level );
  3493. watercolor *= 2.2+watershade;
  3494. watercolor += (.2+.8*watershade) * ((grad-1.0)*.5+specular) * .25;
  3495. watercolor /= (1.+specular1*1.25);
  3496. watercolor += watershade*specular2*water_specularcolor;
  3497. watercolor += watershade*coastfade*(1.-coastfade2)*(vec3(.5, .6, .7)*nautic(uv)+vec3(1., 1., 1.)*particles(uv));
  3498. col = mix(col, watercolor, coastfade);
  3499. }
  3500. outputColor = vec4(col, v_opacity);
  3501. }
  3502. `,wY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  3503. layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_uv;
  3504. layout(std140) uniform commonUniforms {
  3505. vec4 u_watercolor;
  3506. vec4 u_watercolor2;
  3507. float u_time;
  3508. };
  3509. out vec2 v_uv;
  3510. out float v_opacity;
  3511. #pragma include "projection"
  3512. void main() {
  3513. v_uv = a_uv;
  3514. v_opacity = opacity;
  3515. vec4 project_pos = project_position(vec4(a_Position, 1.0));
  3516. gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
  3517. }
  3518. `;class FY extends Qt{constructor(...t){super(...t),E(this,"texture1",void 0),E(this,"texture2",void 0),E(this,"texture3",void 0)}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,UV:9})}getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he({},t.uniformsOption),r.uniformsOption)}getCommonUniformsInfo(){const{watercolor:t="#6D99A8",watercolor2:r="#0F121C"}=this.layer.getLayerConfig(),n={u_watercolor:Zt(t),u_watercolor2:Zt(r),u_time:this.layer.getLayerAnimateTime(),u_texture1:this.texture1,u_texture2:this.texture2,u_texture3:this.texture3};return this.textures=[this.texture1,this.texture2,this.texture3],this.getUniformsBufferInfo(n)}getAnimateUniforms(){return{u_time:this.layer.getLayerAnimateTime()}}initModels(){var t=this;return ve(function*(){return t.loadTexture(),t.buildModels()})()}buildModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"polygonOcean",vertexShader:wY,fragmentShader:LY,defines:t.getDefines(),inject:t.getInject(),triangulation:ku,primitive:m.TRIANGLES,depth:{enable:!1}})]})()}clearModels(){var t,r,n;(t=this.texture1)===null||t===void 0||t.destroy(),(r=this.texture2)===null||r===void 0||r.destroy(),(n=this.texture3)===null||n===void 0||n.destroy()}registerBuiltinAttributes(){const t=this.layer.getSource().extent,[r,n,i,o]=t,a=i-r,s=o-n;this.styleAttributeService.registerStyleAttribute({name:"oceanUv",type:qe.Attribute,descriptor:{name:"a_uv",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:2,update:(u,l,f)=>{const[c,h]=f;return[(c-r)/a,(h-n)/s]}}})}loadTexture(){const{createTexture2D:t}=this.rendererService,r={height:0,width:0};this.texture1=t(r),this.texture2=t(r),this.texture3=t(r),n(o=>{this.texture1=i(o[0]),this.texture2=i(o[1]),this.texture3=i(o[2]),this.layerService.reRender()});function n(o){let a=0;const s=[];["https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*EojwT4VzSiYAAAAAAAAAAAAAARQnAQ","https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*MJ22QbpuCzIAAAAAAAAAAAAAARQnAQ","https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*-z2HSIVDsHIAAAAAAAAAAAAAARQnAQ"].map(l=>{const f=new Image;f.crossOrigin="",f.src=l,s.push(f),f.onload=()=>{a++,a===3&&o(s)}})}function i(o){return t({data:o,width:o.width,height:o.height,wrapS:m.MIRRORED_REPEAT,wrapT:m.MIRRORED_REPEAT,min:m.LINEAR,mag:m.LINEAR})}}}const BY=`uniform sampler2D u_texture;
  3519. layout(std140) uniform commonUniforms {
  3520. float u_speed;
  3521. float u_time;
  3522. };
  3523. out vec4 outputColor;
  3524. in vec4 v_Color;
  3525. in vec2 v_uv;
  3526. float rand(vec2 n) { return 0.5 + 0.5 * fract(sin(dot(n.xy, vec2(12.9898, 78.233)))* 43758.5453); }
  3527. float water(vec3 p) {
  3528. float t = u_time * u_speed;
  3529. p.z += t * 2.; p.x += t * 2.;
  3530. vec3 c1 = texture(SAMPLER_2D(u_texture), p.xz / 30.).xyz;
  3531. p.z += t * 3.; p.x += t * 0.52;
  3532. vec3 c2 = texture(SAMPLER_2D(u_texture), p.xz / 30.).xyz;
  3533. p.z += t * 4.; p.x += t * 0.8;
  3534. vec3 c3 = texture(SAMPLER_2D(u_texture), p.xz / 30.).xyz;
  3535. c1 += c2 - c3;
  3536. float z = (c1.x + c1.y + c1.z) / 3.;
  3537. return p.y + z / 4.;
  3538. }
  3539. float map(vec3 p) {
  3540. float d = 100.0;
  3541. d = water(p);
  3542. return d;
  3543. }
  3544. float intersect(vec3 ro, vec3 rd) {
  3545. float d = 0.0;
  3546. for (int i = 0; i <= 100; i++) {
  3547. float h = map(ro + rd * d);
  3548. if (h < 0.1) return d;
  3549. d += h;
  3550. }
  3551. return 0.0;
  3552. }
  3553. vec3 norm(vec3 p) {
  3554. float eps = .1;
  3555. return normalize(vec3(
  3556. map(p + vec3(eps, 0, 0)) - map(p + vec3(-eps, 0, 0)),
  3557. map(p + vec3(0, eps, 0)) - map(p + vec3(0, -eps, 0)),
  3558. map(p + vec3(0, 0, eps)) - map(p + vec3(0, 0, -eps))
  3559. ));
  3560. }
  3561. float calSpc() {
  3562. vec3 l1 = normalize(vec3(1, 1, 1));
  3563. vec3 ro = vec3(-3, 20, -8);
  3564. vec3 rc = vec3(0, 0, 0);
  3565. vec3 ww = normalize(rc - ro);
  3566. vec3 uu = normalize(cross(vec3(0,1,0), ww));
  3567. vec3 vv = normalize(cross(rc - ro, uu));
  3568. vec3 rd = normalize(uu * v_uv.x + vv * v_uv.y + ww);
  3569. float d = intersect(ro, rd);
  3570. vec3 p = ro + rd * d;
  3571. vec3 n = norm(p);
  3572. float spc = pow(max(0.0, dot(reflect(l1, n), rd)), 30.0);
  3573. return spc;
  3574. }
  3575. void main() {
  3576. outputColor = v_Color;
  3577. float spc = calSpc();
  3578. outputColor += spc * 0.4;
  3579. }
  3580. `,DY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  3581. layout(location = ATTRIBUTE_LOCATION_COLOR) in vec4 a_Color;
  3582. layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_uv;
  3583. layout(std140) uniform commonUniforms {
  3584. float u_speed;
  3585. float u_time;
  3586. };
  3587. out vec4 v_Color;
  3588. out vec2 v_uv;
  3589. #pragma include "projection"
  3590. void main() {
  3591. v_uv = a_uv;
  3592. v_Color = a_Color;
  3593. v_Color.a *= opacity;
  3594. vec4 project_pos = project_position(vec4(a_Position, 1.0));
  3595. gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
  3596. }
  3597. `;class UY extends Qt{constructor(...t){super(...t),E(this,"texture",void 0)}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,UV:9})}getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he({},t.uniformsOption),r.uniformsOption)}getCommonUniformsInfo(){const{speed:t=.5}=this.layer.getLayerConfig(),r={u_speed:t,u_time:this.layer.getLayerAnimateTime(),u_texture:this.texture};return this.textures=[this.texture],this.getUniformsBufferInfo(r)}getAnimateUniforms(){return{u_time:this.layer.getLayerAnimateTime()}}initModels(){var t=this;return ve(function*(){return t.loadTexture(),t.buildModels()})()}buildModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"polygonWater",vertexShader:DY,fragmentShader:BY,triangulation:ku,defines:t.getDefines(),inject:t.getInject(),primitive:m.TRIANGLES,depth:{enable:!1},pickingEnabled:!1,diagnosticDerivativeUniformityEnabled:!1})]})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy()}registerBuiltinAttributes(){const t=this.layer.getSource().extent,[r,n,i,o]=t,a=i-r,s=o-n;this.styleAttributeService.registerStyleAttribute({name:"waterUv",type:qe.Attribute,descriptor:{name:"a_uv",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.STATIC_DRAW,data:[],type:m.FLOAT},size:2,update:(u,l,f)=>{const[c,h]=f;return[(c-r)/a,(h-n)/s]}}})}loadTexture(){const{waterTexture:t}=this.layer.getLayerConfig(),{createTexture2D:r}=this.rendererService;this.texture=r({height:1,width:1});const n=new Image;n.crossOrigin="",t?(console.warn("L7 recommend:https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*EojwT4VzSiYAAAAAAAAAAAAAARQnAQ"),n.src=t):n.src="https://gw.alipayobjects.com/mdn/rms_816329/afts/img/A*EojwT4VzSiYAAAAAAAAAAAAAARQnAQ",n.onload=()=>{this.texture=r({data:n,width:n.width,height:n.height,wrapS:m.MIRRORED_REPEAT,wrapT:m.MIRRORED_REPEAT,min:m.LINEAR,mag:m.LINEAR}),this.layerService.reRender()}}}const kY={fill:PY,line:BS,extrude:xY,text:jS,point_fill:kS,point_image:$S,point_normal:zS,point_extrude:US,water:UY,ocean:FY,extrusion:CY};class XS extends Ka{constructor(...t){super(...t),E(this,"type","PolygonLayer"),E(this,"enableShaderEncodeStyles",["opacity","extrusionBase","rotation","offsets","stroke"])}buildModels(){var t=this;return ve(function*(){const r=t.getModelType();t.layerModel=new kY[r](t),yield t.initLayerModels()})()}getModelType(){var t;const r=this.styleAttributeService.getLayerStyleAttribute("shape"),n=r==null||(t=r.scale)===null||t===void 0?void 0:t.field;return n==="fill"||!n?"fill":n==="extrude"?"extrude":n==="extrusion"?"extrusion":n==="water"?"water":n==="ocean"?"ocean":n==="line"?"line":this.getPointModelType()}getPointModelType(){const t=this.getEncodedData(),{shape2d:r,shape3d:n}=this.getLayerConfig(),i=this.iconService.getIconMap(),o=t.find(a=>a.hasOwnProperty("shape"));if(o){const a=o.shape;return a==="dot"?"point_normal":(r==null?void 0:r.indexOf(a))!==-1?"point_fill":(n==null?void 0:n.indexOf(a))!==-1?"point_extrude":i.hasOwnProperty(a)?"point_image":"text"}else return"fill"}}const $Y=`layout(std140) uniform commonUniforms {
  3598. vec2 u_domain;
  3599. float u_opacity;
  3600. float u_noDataValue;
  3601. float u_clampLow;
  3602. float u_clampHigh;
  3603. };
  3604. uniform sampler2D u_rasterTexture;
  3605. uniform sampler2D u_colorTexture;
  3606. in vec2 v_texCoord;
  3607. bool isnan_emu(float x) { return (x > 0.0 || x < 0.0) ? x != x : x != 0.0; }
  3608. out vec4 outputColor;
  3609. void main() {
  3610. // Can use any component here since u_rasterTexture is under luminance format.
  3611. float value = texture(SAMPLER_2D(u_rasterTexture), vec2(v_texCoord.x, v_texCoord.y)).r;
  3612. if (value == u_noDataValue || isnan_emu(value)) {
  3613. discard;
  3614. } else if ((u_clampLow < 0.5 && value < u_domain[0]) || (u_clampHigh < 0.5 && value > u_domain[1])) {
  3615. discard;
  3616. } else {
  3617. float normalisedValue =(value - u_domain[0]) / (u_domain[1] - u_domain[0]);
  3618. vec4 color = texture(SAMPLER_2D(u_colorTexture), vec2(normalisedValue, 0));
  3619. outputColor = color;
  3620. outputColor.a = outputColor.a * u_opacity ;
  3621. if (outputColor.a < 0.01)
  3622. discard;
  3623. }
  3624. }
  3625. `,zY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  3626. layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
  3627. layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
  3628. layout(std140) uniform commonUniforms {
  3629. vec2 u_domain;
  3630. float u_opacity;
  3631. float u_noDataValue;
  3632. float u_clampLow;
  3633. float u_clampHigh;
  3634. };
  3635. out vec2 v_texCoord;
  3636. #pragma include "projection"
  3637. void main() {
  3638. v_texCoord = a_Uv;
  3639. vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
  3640. gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));
  3641. }
  3642. `;let o1=class extends Qt{constructor(...t){super(...t),E(this,"texture",void 0),E(this,"colorTexture",void 0)}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,UV:9})}getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he({},t.uniformsOption),r.uniformsOption)}getCommonUniformsInfo(){const{opacity:t=1,clampLow:r=!0,clampHigh:n=!0,noDataValue:i=-9999999,domain:o,rampColors:a}=this.layer.getLayerConfig(),s=o||gp(a);this.colorTexture=this.layer.textureService.getColorTexture(a,s);const u={u_domain:s,u_opacity:t||1,u_noDataValue:i,u_clampLow:r?1:0,u_clampHigh:(typeof n<"u"?n:r)?1:0,u_rasterTexture:this.texture,u_colorTexture:this.colorTexture};return this.textures=[this.texture,this.colorTexture],this.getUniformsBufferInfo(u)}getRasterData(t){return ve(function*(){if(Array.isArray(t.data))return{data:t.data,width:t.width,height:t.height};{const{rasterData:r,width:n,height:i}=yield t.data;return{data:Array.from(r),width:n,height:i}}})()}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}buildModels(){var t=this;return ve(function*(){t.initUniformsBuffer();const r=t.layer.getSource(),{createTexture2D:n,queryVerdorInfo:i}=t.rendererService,o=r.data.dataArray[0],{data:a,width:s,height:u}=yield t.getRasterData(o);return t.texture=n({data:new Float32Array(a),width:s,height:u,format:i()==="WebGL1"?m.LUMINANCE:m.RED,type:m.FLOAT,alignment:1}),[yield t.layer.buildLayerModel({moduleName:"rasterImageData",vertexShader:zY,fragmentShader:$Y,defines:t.getDefines(),triangulation:_f,primitive:m.TRIANGLES,depth:{enable:!1},pickingEnabled:!1})]})()}clearModels(){var t,r;(t=this.texture)===null||t===void 0||t.destroy(),(r=this.colorTexture)===null||r===void 0||r.destroy()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{shaderLocation:this.attributeLocation.UV,name:"a_Uv",buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:(t,r,n)=>[n[3],n[4]]}})}};const VY=["data"],HY=["rasterData"],jY=`uniform sampler2D u_texture;
  3643. layout(std140) uniform commonUniforms {
  3644. vec2 u_rminmax;
  3645. vec2 u_gminmax;
  3646. vec2 u_bminmax;
  3647. float u_opacity;
  3648. float u_noDataValue;
  3649. };
  3650. in vec2 v_texCoord;
  3651. out vec4 outputColor;
  3652. void main() {
  3653. vec3 rgb = texture(SAMPLER_2D(u_texture),vec2(v_texCoord.x,v_texCoord.y)).rgb;
  3654. if(rgb == vec3(u_noDataValue)) {
  3655. outputColor = vec4(0.0, 0, 0, 0.0);
  3656. } else {
  3657. outputColor = vec4(rgb.r / (u_rminmax.y -u_rminmax.x), rgb.g /(u_gminmax.y -u_gminmax.x), rgb.b/ (u_bminmax.y - u_bminmax.x), u_opacity);
  3658. }
  3659. if(outputColor.a < 0.01)
  3660. discard;
  3661. }`,XY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  3662. layout(location = ATTRIBUTE_LOCATION_POSITION_64LOW) in vec2 a_Position64Low;
  3663. layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
  3664. layout(std140) uniform commonUniforms {
  3665. vec2 u_rminmax;
  3666. vec2 u_gminmax;
  3667. vec2 u_bminmax;
  3668. float u_opacity;
  3669. float u_noDataValue;
  3670. };
  3671. out vec2 v_texCoord;
  3672. #pragma include "projection"
  3673. void main() {
  3674. v_texCoord = a_Uv;
  3675. vec4 project_pos = project_position(vec4(a_Position, 1.0), a_Position64Low);
  3676. gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));
  3677. }
  3678. `;class WY extends Qt{constructor(...t){super(...t),E(this,"texture",void 0),E(this,"dataOption",{})}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,UV:9})}getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he({},t.uniformsOption),r.uniformsOption)}getCommonUniformsInfo(){const{opacity:t=1,noDataValue:r=0}=this.layer.getLayerConfig(),{rMinMax:n=[0,255],gMinMax:i=[0,255],bMinMax:o=[0,255]}=this.dataOption,a={u_rminmax:n,u_gminmax:i,u_bminmax:o,u_opacity:t||1,u_noDataValue:r,u_texture:this.texture};return this.textures=[this.texture],this.getUniformsBufferInfo(a)}getRasterData(t){var r=this;return ve(function*(){if(Array.isArray(t.data)){const{data:a}=t,s=ai(t,VY);return r.dataOption=s,he({data:a},s)}const n=yield t.data,{rasterData:i}=n,o=ai(n,HY);return r.dataOption=o,Array.isArray(i)?he({data:i},o):he({data:Array.from(i)},o)})()}initModels(){var t=this;return ve(function*(){t.initUniformsBuffer();const r=t.layer.getSource(),{createTexture2D:n}=t.rendererService,i=r.data.dataArray[0],{data:o,width:a,height:s}=yield t.getRasterData(i);return t.texture=n({data:new Float32Array(o),width:a,height:s,format:m.RGB,type:m.FLOAT}),[yield t.layer.buildLayerModel({moduleName:"rasterImageDataRGBA",vertexShader:XY,fragmentShader:jY,defines:t.getDefines(),triangulation:_f,primitive:m.TRIANGLES,depth:{enable:!1},pickingEnabled:!1})]})()}buildModels(){var t=this;return ve(function*(){return t.initModels()})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_Uv",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:(t,r,n)=>[n[3],n[4]]}})}}const GY=`uniform sampler2D u_texture;
  3679. uniform sampler2D u_colorTexture;
  3680. layout(std140) uniform commonUniforms {
  3681. vec4 u_unpack;
  3682. vec2 u_domain;
  3683. float u_opacity;
  3684. float u_noDataValue;
  3685. float u_clampLow;
  3686. float u_clampHigh;
  3687. };
  3688. in vec2 v_texCoord;
  3689. out vec4 outputColor;
  3690. float getElevation(vec2 coord, float bias) {
  3691. // Convert encoded elevation value to meters
  3692. vec4 data = texture(SAMPLER_2D(u_texture), coord,bias) * 255.0;
  3693. data.a = -1.0;
  3694. return dot(data, u_unpack);
  3695. }
  3696. vec4 getColor(float value) {
  3697. float normalisedValue =(value- u_domain[0]) / (u_domain[1] - u_domain[0]);
  3698. vec2 coord = vec2(normalisedValue, 0);
  3699. return texture(SAMPLER_2D(u_colorTexture), coord);
  3700. }
  3701. void main() {
  3702. float value = getElevation(v_texCoord,0.0);
  3703. if (value == u_noDataValue) {
  3704. outputColor = vec4(0.0, 0, 0, 0.0);
  3705. } else if ((u_clampLow < 0.5 && value < u_domain[0]) || (u_clampHigh < 0.5 && value > u_domain[1])) {
  3706. outputColor = vec4(0.0, 0, 0, 0.0);
  3707. } else {
  3708. outputColor = getColor(value);
  3709. outputColor.a = outputColor.a * u_opacity ;
  3710. if(outputColor.a < 0.01)
  3711. discard;
  3712. }
  3713. }
  3714. `,YY=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  3715. layout(location = ATTRIBUTE_LOCATION_UV) in vec2 a_Uv;
  3716. layout(std140) uniform commonUniforms {
  3717. vec4 u_unpack;
  3718. vec2 u_domain;
  3719. float u_opacity;
  3720. float u_noDataValue;
  3721. float u_clampLow;
  3722. float u_clampHigh;
  3723. };
  3724. out vec2 v_texCoord;
  3725. #pragma include "projection"
  3726. void main() {
  3727. v_texCoord = a_Uv;
  3728. vec4 project_pos = project_position(vec4(a_Position, 1.0));
  3729. gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));
  3730. }
  3731. `;class ZY extends Qt{constructor(...t){super(...t),E(this,"texture",void 0)}get attributeLocation(){return Object.assign(super.attributeLocation,{MAX:super.attributeLocation.MAX,UV:9})}getCommonUniformsInfo(){const{opacity:t,clampLow:r=!0,clampHigh:n=!0,noDataValue:i=-9999999,domain:o,rampColors:a,colorTexture:s,rScaler:u=6553.6,gScaler:l=25.6,bScaler:f=.1,offset:c=1e4}=this.layer.getLayerConfig(),h=o||gp(a);let d=s;s?this.layer.textureService.setColorTexture(s,a,h):d=this.layer.textureService.getColorTexture(a,h);const p={u_unpack:[u,l,f,c],u_domain:h,u_opacity:t||1,u_noDataValue:i,u_clampLow:r,u_clampHigh:typeof n<"u"?n:r,u_texture:this.texture,u_colorTexture:d};return this.textures=[this.texture,d],this.getUniformsBufferInfo(p)}initModels(){var t=this;return ve(function*(){t.initUniformsBuffer();const r=t.layer.getSource(),{createTexture2D:n}=t.rendererService,i=yield r.data.images;return t.texture=n({data:i[0],width:i[0].width,height:i[0].height,min:m.LINEAR,mag:m.LINEAR}),[yield t.layer.buildLayerModel({moduleName:"RasterTileDataImage",vertexShader:YY,fragmentShader:GY,defines:t.getDefines(),triangulation:_f,primitive:m.TRIANGLES,depth:{enable:!1}})]})()}clearModels(){var t;(t=this.texture)===null||t===void 0||t.destroy()}buildModels(){var t=this;return ve(function*(){return t.initModels()})()}registerBuiltinAttributes(){this.registerPosition64LowAttribute(),this.styleAttributeService.registerStyleAttribute({name:"uv",type:qe.Attribute,descriptor:{name:"a_Uv",shaderLocation:this.attributeLocation.UV,buffer:{usage:m.DYNAMIC_DRAW,data:[],type:m.FLOAT},size:2,update:(t,r,n)=>[n[3],n[4]]}})}}const qY={raster:o1,rasterRgb:WY,raster3d:o1,rasterTerrainRgb:ZY};class n_ extends Ka{constructor(...t){super(...t),E(this,"type","RasterLayer")}buildModels(){var t=this;return ve(function*(){const r=t.getModelType();t.layerModel=new qY[r](t),yield t.initLayerModels()})()}getDefaultConfig(){const t=this.getModelType();return{raster:{},rasterRgb:{},raster3d:{},rasterTerrainRgb:{}}[t]}getModelType(){switch(this.layerSource.getParserType()){case"raster":return"raster";case"rasterRgb":return"rasterRgb";case"rgb":return"rasterRgb";case"image":return"rasterTerrainRgb";default:return"raster"}}getLegend(t){if(t!=="color")return{type:void 0,field:void 0,items:[]};const r=this.getLayerConfig().rampColors;return tG(r,t)}}class KY{constructor({rendererService:t,layerService:r,parent:n}){E(this,"tileResource",new Map),E(this,"rendererService",void 0),E(this,"layerService",void 0),E(this,"parent",void 0),E(this,"layerTiles",[]),this.rendererService=t,this.layerService=r,this.parent=n}get tiles(){return this.layerTiles}hasTile(t){return this.layerTiles.some(r=>r.key===t)}addTile(t){this.layerTiles.push(t)}getTile(t){return this.layerTiles.find(r=>r.key===t)}getVisibleTileBylngLat(t){return this.layerTiles.find(r=>r.isLoaded&&r.visible&&r.lnglatInBounds(t))}removeTile(t){const r=this.layerTiles.findIndex(i=>i.key===t),n=this.layerTiles.splice(r,1);n[0]&&n[0].destroy()}updateTileVisible(t){const r=this.getTile(t.key);if(t.isVisible)if(t.parent){const n=this.isChildrenLoaded(t.parent);r==null||r.updateVisible(n)}else r==null||r.updateVisible(!0);else if(t.parent){const n=this.isChildrenLoaded(t.parent);r==null||r.updateVisible(!n)}else r==null||r.updateVisible(!1)}isParentLoaded(t){const r=t.parent;if(!r)return!0;const n=this.getTile(r==null?void 0:r.key);return!!(n!=null&&n.isLoaded)}isChildrenLoaded(t){const r=t==null?void 0:t.children;return r.length===0?!0:r.every(n=>{const i=this.getTile(n==null?void 0:n.key);return i?(i==null?void 0:i.isLoaded)===!0:!0})}render(){var t=this;return ve(function*(){const n=t.getRenderLayers().map(function(){var i=ve(function*(o){yield t.layerService.renderTileLayer(o)});return function(o){return i.apply(this,arguments)}}());yield Promise.all(n)})()}getRenderLayers(){const t=this.layerTiles.filter(n=>n.visible&&n.isLoaded),r=[];return t.map(n=>r.push(...n.getLayers())),r}getLayers(){const t=this.layerTiles.filter(n=>n.isLoaded),r=[];return t.map(n=>r.push(...n.getLayers())),r}getTiles(){return this.layerTiles}des
  3732. * splaytree v3.1.2
  3733. * Fast Splay tree for Node and browser
  3734. *
  3735. * @author Alexander Milevski <info@w8r.name>
  3736. * @license MIT
  3737. * @preserve
  3738. *//*! *****************************************************************************
  3739. Copyright (c) Microsoft Corporation. All rights reserved.
  3740. Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  3741. this file except in compliance with the License. You may obtain a copy of the
  3742. License at http://www.apache.org/licenses/LICENSE-2.0
  3743. THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  3744. KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  3745. WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  3746. MERCHANTABLITY OR NON-INFRINGEMENT.
  3747. See the Apache Version 2.0 License for specific language governing permissions
  3748. and limitations under the License.
  3749. ***************************************************************************** */function QY(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(l){return function(f){return u([l,f])}}function u(l){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=l[0]&2?i.return:l[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,l[1])).done)return o;switch(i=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return r.label++,{value:l[1],done:!1};case 5:r.label++,i=l[1],l=[0];continue;case 7:l=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){r.label=l[1];break}if(l[0]===6&&r.label<o[1]){r.label=o[1],o=l;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(l);break}o[2]&&r.ops.pop(),r.trys.pop();continue}l=t.call(e,r)}catch(f){l=[6,f],i=0}finally{n=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}var Gi=function(){function e(t,r){this.next=null,this.key=t,this.data=r,this.left=null,this.right=null}return e}();function JY(e,t){return e>t?1:e<t?-1:0}function $i(e,t,r){for(var n=new Gi(null,null),i=n,o=n;;){var a=r(e,t.key);if(a<0){if(t.left===null)break;if(r(e,t.left.key)<0){var s=t.left;if(t.left=s.right,s.right=t,t=s,t.left===null)break}o.left=t,o=t,t=t.left}else if(a>0){if(t.right===null)break;if(r(e,t.right.key)>0){var s=t.right;if(t.right=s.left,s.left=t,t=s,t.right===null)break}i.right=t,i=t,t=t.right}else break}return i.right=t.left,o.left=t.right,t.left=n.right,t.right=n.left,t}function Jh(e,t,r,n){var i=new Gi(e,t);if(r===null)return i.left=i.right=null,i;r=$i(e,r,n);var o=n(e,r.key);return o<0?(i.left=r.left,i.right=r,r.left=null):o>=0&&(i.right=r.right,i.left=r,r.right=null),i}function a1(e,t,r){var n=null,i=null;if(t){t=$i(e,t,r);var o=r(t.key,e);o===0?(n=t.left,i=t.right):o<0?(i=t.right,t.right=null,n=t):(n=t.left,t.left=null,i=t)}return{left:n,right:i}}function eZ(e,t,r){return t===null?e:(e===null||(t=$i(e.key,t,r),t.left=e),t)}function Jd(e,t,r,n,i){if(e){n(""+t+(r?" ":" ")+i(e)+`
  3750. `);var o=t+(r?" ":"│ ");e.left&&Jd(e.left,o,!1,n,i),e.right&&Jd(e.right,o,!0,n,i)}}var i_=function(){function e(t){t===void 0&&(t=JY),this._root=null,this._size=0,this._comparator=t}return e.prototype.insert=function(t,r){return this._size++,this._root=Jh(t,r,this._root,this._comparator)},e.prototype.add=function(t,r){var n=new Gi(t,r);this._root===null&&(n.left=n.right=null,this._size++,this._root=n);var i=this._comparator,o=$i(t,this._root,i),a=i(t,o.key);return a===0?this._root=o:(a<0?(n.left=o.left,n.right=o,o.left=null):a>0&&(n.right=o.right,n.left=o,o.right=null),this._size++,this._root=n),this._root},e.prototype.remove=function(t){this._root=this._remove(t,this._root,this._comparator)},e.prototype._remove=function(t,r,n){var i;if(r===null)return null;r=$i(t,r,n);var o=n(t,r.key);return o===0?(r.left===null?i=r.right:(i=$i(t,r.left,n),i.right=r.right),this._size--,i):r},e.prototype.pop=function(){var t=this._root;if(t){for(;t.left;)t=t.left;return this._root=$i(t.key,this._root,this._comparator),this._root=this._remove(t.key,this._root,this._comparator),{key:t.key,data:t.data}}return null},e.prototype.findStatic=function(t){for(var r=this._root,n=this._comparator;r;){var i=n(t,r.key);if(i===0)return r;i<0?r=r.left:r=r.right}return null},e.prototype.find=function(t){return this._root&&(this._root=$i(t,this._root,this._comparator),this._comparator(t,this._root.key)!==0)?null:this._root},e.prototype.contains=function(t){for(var r=this._root,n=this._comparator;r;){var i=n(t,r.key);if(i===0)return!0;i<0?r=r.left:r=r.right}return!1},e.prototype.forEach=function(t,r){for(var n=this._root,i=[],o=!1;!o;)n!==null?(i.push(n),n=n.left):i.length!==0?(n=i.pop(),t.call(r,n),n=n.right):o=!0;return this},e.prototype.range=function(t,r,n,i){for(var o=[],a=this._comparator,s=this._root,u;o.length!==0||s;)if(s)o.push(s),s=s.left;else{if(s=o.pop(),u=a(s.key,r),u>0)break;if(a(s.key,t)>=0&&n.call(i,s))return this;s=s.right}return this},e.prototype.keys=function(){var t=[];return this.forEach(function(r){var n=r.key;return t.push(n)}),t},e.prototype.values=function(){var t=[];return this.forEach(function(r){var n=r.data;return t.push(n)}),t},e.prototype.min=function(){return this._root?this.minNode(this._root).key:null},e.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},e.prototype.minNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.left;)t=t.left;return t},e.prototype.maxNode=function(t){if(t===void 0&&(t=this._root),t)for(;t.right;)t=t.right;return t},e.prototype.at=function(t){for(var r=this._root,n=!1,i=0,o=[];!n;)if(r)o.push(r),r=r.left;else if(o.length>0){if(r=o.pop(),i===t)return r;i++,r=r.right}else n=!0;return null},e.prototype.next=function(t){var r=this._root,n=null;if(t.right){for(n=t.right;n.left;)n=n.left;return n}for(var i=this._comparator;r;){var o=i(t.key,r.key);if(o===0)break;o<0?(n=r,r=r.left):r=r.right}return n},e.prototype.prev=function(t){var r=this._root,n=null;if(t.left!==null){for(n=t.left;n.right;)n=n.right;return n}for(var i=this._comparator;r;){var o=i(t.key,r.key);if(o===0)break;o<0?r=r.left:(n=r,r=r.right)}return n},e.prototype.clear=function(){return this._root=null,this._size=0,this},e.prototype.toList=function(){return rZ(this._root)},e.prototype.load=function(t,r,n){r===void 0&&(r=[]),n===void 0&&(n=!1);var i=t.length,o=this._comparator;if(n&&rp(t,r,0,i-1,o),this._root===null)this._root=ep(t,r,0,i),this._size=i;else{var a=nZ(this.toList(),tZ(t,r),o);i=this._size+i,this._root=tp({head:a},0,i)}return this},e.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(e.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),e.prototype.toString=function(t){t===void 0&&(t=function(n){return String(n.key)});var r=[];return Jd(this._root,"",!0,function(n){return r.push(n)},t),r.join("")},e.prototype.update=function(t,r,n){var i=this._comparator,o=a1(t,this._root,i),a=o.left,s=o.right;i(t,r)<0?s=Jh(r,n,s,i):a=Jh(r,n,a
  3751. vec4 u_color;
  3752. float u_opacity;
  3753. };
  3754. out vec4 outputColor;
  3755. void main() {
  3756. outputColor = u_color;
  3757. outputColor.a *= u_opacity;
  3758. }
  3759. `,FZ=`layout(location = ATTRIBUTE_LOCATION_POSITION) in vec3 a_Position;
  3760. layout(std140) uniform commonUniorm {
  3761. vec4 u_color;
  3762. float u_opacity;
  3763. };
  3764. #pragma include "projection"
  3765. void main() {
  3766. vec4 project_pos = project_position(vec4(a_Position, 1.0));
  3767. gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));
  3768. }
  3769. `;class BZ extends Qt{getUninforms(){const t=this.getCommonUniformsInfo(),r=this.getUniformsBufferInfo(this.getStyleAttribute());return this.updateStyleUnifoms(),he(he({},t.uniformsOption),r.uniformsOption)}getCommonUniformsInfo(){const{opacity:t=1,color:r="#000"}=this.layer.getLayerConfig(),n={u_color:Zt(r),u_opacity:t||1};return this.getUniformsBufferInfo(n)}initModels(){var t=this;return ve(function*(){return t.buildModels()})()}buildModels(){var t=this;return ve(function*(){return t.initUniformsBuffer(),[yield t.layer.buildLayerModel({moduleName:"mask",vertexShader:FZ,fragmentShader:wZ,defines:t.getDefines(),triangulation:ku,depth:{enable:!1},pick:!1})]})()}clearModels(t=!0){t&&this.layerService.clear()}registerBuiltinAttributes(){return""}}const DZ={fill:BZ};class YS extends Ka{constructor(...t){super(...t),E(this,"type","MaskLayer")}buildModels(){var t=this;return ve(function*(){const r=t.getModelType();t.layerModel=new DZ[r](t),yield t.initLayerModels()})()}getModelType(){return"fill"}}class UZ extends Lo{initTileLayer(){var t=this;return ve(function*(){const r=t.parent.getLayerAttributeConfig(),n=t.getLayerOptions(),i=t.getSourceOption(),o=new YS(he({},n)).source(i.data,i.options);r&&Object.keys(r).forEach(a=>{var s,u;const l=a;o[l]((s=r[l])===null||s===void 0?void 0:s.field,(u=r[l])===null||u===void 0?void 0:u.values)}),yield t.addLayer(o),t.isLoaded=!0})()}getFeatures(t){return t?this.sourceTile.data.getTileData(t):[]}getSourceOption(){const t=this.parent.getSource(),{sourceLayer:r,featureId:n}=this.parent.getLayerConfig();return{data:{type:"FeatureCollection",features:this.getFeatures(r)},options:{parser:{type:"geojson",featureId:n},transforms:t.transforms}}}}const kZ=["rasterData"];let $Z=class extends Lo{initTileLayer(){var t=this;return ve(function*(){const r=t.parent.getLayerAttributeConfig(),n=t.getLayerOptions(),i=t.getSourceOption(),o=new n_(he({},n)).source(i.data,i.options);r&&Object.keys(r).forEach(a=>{var s,u;const l=a;o[l]((s=r[l])===null||s===void 0?void 0:s.field,(u=r[l])===null||u===void 0?void 0:u.values)}),yield t.addLayer(o),t.isLoaded=!0})()}getSourceOption(){const t=this.parent.getSource(),r=this.sourceTile.data.data,{rasterData:n}=r,i=ai(r,kZ);return{data:n,options:{parser:he({type:"rasterRgb",extent:this.sourceTile.bounds},i),transforms:t.transforms}}}};class zZ extends Lo{initTileLayer(){var t=this;return ve(function*(){const r=t.parent.getLayerAttributeConfig(),n=t.getLayerOptions(),i=t.getSourceOption(),o=new n_(he({},n)).source(i.data,i.options);r&&Object.keys(r).forEach(a=>{var s,u;const l=a;o[l]((s=r[l])===null||s===void 0?void 0:s.field,(u=r[l])===null||u===void 0?void 0:u.values)}),yield t.addLayer(o),t.isLoaded=!0})()}getSourceOption(){const t=this.parent.getSource();return{data:this.sourceTile.data,options:{parser:{type:"image",extent:this.sourceTile.bounds},transforms:t.transforms}}}}const VZ=["rasterData"],HZ={positions:[0,1],colors:["#000","#fff"]};class jZ extends Lo{constructor(...t){super(...t),E(this,"colorTexture",void 0)}initTileLayer(){var t=this;return ve(function*(){const r=t.parent.getLayerAttributeConfig(),n=t.getLayerOptions(),i=t.getSourceOption(),{rampColors:o,domain:a}=t.getLayerOptions();t.colorTexture=t.parent.textureService.getColorTexture(o,a);const s=new n_(he(he({},n),{},{colorTexture:t.colorTexture})).source(i.data,i.options);r&&Object.keys(r).forEach(u=>{var l,f;const c=u;s[c]((l=r[c])===null||l===void 0?void 0:l.field,(f=r[c])===null||f===void 0?void 0:f.values)}),yield t.addLayer(s),t.isLoaded=!0})()}getSourceOption(){const t=this.parent.getSource(),r=this.sourceTile.data.data,{rasterData:n}=r,i=ai(r,VZ);return{data:n,options:{parser:he({type:"raster",extent:this.sourceTile.bounds},i),transforms:t.transforms}}}styleUpdate(...t){const{rampColors:r=HZ,domain:n}=t;this.colorTexture=this.parent.textureService.getColorTexture(r,n||gp(r)),this.layers.forEach(i=>i.style({colorTexture:this.colorTexture}))}destroy(){this.layers.forEach(t=>t.destroy())}}class kl extends Lo{initTileLayer(){var t=this;return ve(function*(){const r=t.parent.getLayerAttributeConfi
  3770. position: absolute;
  3771. width: 100%;
  3772. height: 100%;
  3773. overflow: hidden;
  3774. }
  3775. .l7-marker {
  3776. position: absolute !important;
  3777. top: 0;
  3778. left: 0;
  3779. z-index: 5;
  3780. cursor: pointer;
  3781. }
  3782. .l7-marker-cluster {
  3783. width: 40px;
  3784. height: 40px;
  3785. background-color: rgba(181, 226, 140, 0.6);
  3786. background-clip: padding-box;
  3787. border-radius: 20px;
  3788. }
  3789. .l7-marker-cluster div {
  3790. width: 30px;
  3791. height: 30px;
  3792. margin-top: 5px;
  3793. margin-left: 5px;
  3794. font:
  3795. 12px 'Helvetica Neue',
  3796. Arial,
  3797. Helvetica,
  3798. sans-serif;
  3799. text-align: center;
  3800. background-color: rgba(110, 204, 57, 0.6);
  3801. border-radius: 15px;
  3802. }
  3803. .l7-marker-cluster span {
  3804. line-height: 30px;
  3805. }
  3806. .l7-touch .l7-control-attribution,
  3807. .l7-touch .l7-control-layers,
  3808. .l7-touch .l7-bar {
  3809. box-shadow: none;
  3810. }
  3811. .l7-touch .l7-control-layers,
  3812. .l7-touch .l7-bar {
  3813. background-clip: padding-box;
  3814. border: 2px solid rgba(0, 0, 0, 0.2);
  3815. }
  3816. .mapboxgl-ctrl-logo,
  3817. .amap-logo {
  3818. display: none !important;
  3819. }
  3820. .l7-select-box {
  3821. border: 3px dashed gray;
  3822. border-radius: 2px;
  3823. position: absolute;
  3824. z-index: 999;
  3825. box-sizing: border-box;
  3826. }
  3827. .l7-control-container {
  3828. font:
  3829. 12px/1.5 'Helvetica Neue',
  3830. Arial,
  3831. Helvetica,
  3832. sans-serif;
  3833. }
  3834. .l7-control-container .l7-control {
  3835. position: relative;
  3836. z-index: 999;
  3837. float: left;
  3838. clear: both;
  3839. color: #595959;
  3840. font-size: 12px;
  3841. pointer-events: visiblePainted;
  3842. /* IE 9-10 doesn't have auto */
  3843. pointer-events: auto;
  3844. }
  3845. .l7-control-container .l7-control.l7-control--hide {
  3846. display: none;
  3847. }
  3848. .l7-control-container .l7-top {
  3849. top: 0;
  3850. display: flex;
  3851. position: absolute;
  3852. z-index: 999;
  3853. pointer-events: none;
  3854. }
  3855. .l7-control-container .l7-top .l7-control:not(.l7-control--hide) {
  3856. margin-top: 8px;
  3857. }
  3858. .l7-control-container .l7-right {
  3859. right: 0;
  3860. display: flex;
  3861. position: absolute;
  3862. z-index: 999;
  3863. pointer-events: none;
  3864. }
  3865. .l7-control-container .l7-right .l7-control:not(.l7-control--hide) {
  3866. margin-right: 8px;
  3867. }
  3868. .l7-control-container .l7-bottom {
  3869. bottom: 0;
  3870. display: flex;
  3871. position: absolute;
  3872. z-index: 999;
  3873. pointer-events: none;
  3874. }
  3875. .l7-control-container .l7-bottom .l7-control:not(.l7-control--hide) {
  3876. margin-bottom: 8px;
  3877. }
  3878. .l7-control-container .l7-left {
  3879. left: 0;
  3880. display: flex;
  3881. position: absolute;
  3882. z-index: 999;
  3883. pointer-events: none;
  3884. }
  3885. .l7-control-container .l7-left .l7-control:not(.l7-control--hide) {
  3886. margin-left: 8px;
  3887. }
  3888. .l7-control-container .l7-center {
  3889. position: absolute;
  3890. display: flex;
  3891. justify-content: center;
  3892. }
  3893. .l7-control-container .l7-center.l7-top,
  3894. .l7-control-container .l7-center.l7-bottom {
  3895. width: 100%;
  3896. }
  3897. .l7-control-container .l7-center.l7-left,
  3898. .l7-control-container .l7-center.l7-right {
  3899. height: 100%;
  3900. }
  3901. .l7-control-container .l7-center .l7-control {
  3902. margin-right: 8px;
  3903. margin-bottom: 8px;
  3904. }
  3905. .l7-control-container .l7-row {
  3906. flex-direction: row;
  3907. }
  3908. .l7-control-container .l7-row.l7-top {
  3909. align-items: flex-start;
  3910. }
  3911. .l7-control-container .l7-row.l7-bottom {
  3912. align-items: flex-end;
  3913. }
  3914. .l7-control-container .l7-column {
  3915. flex-direction: column;
  3916. }
  3917. .l7-control-container .l7-column.l7-left {
  3918. align-items: flex-start;
  3919. }
  3920. .l7-control-container .l7-column.l7-right {
  3921. align-items: flex-end;
  3922. }
  3923. .l7-button-control {
  3924. min-width: 28px;
  3925. height: 28px;
  3926. background-color: #fff;
  3927. border-width: 0;
  3928. border-radius: 2px;
  3929. outline: 0;
  3930. cursor: pointer;
  3931. transition: all 0.2s;
  3932. display: flex;
  3933. justify-content: center;
  3934. align-items: center;
  3935. padding: 0 6px;
  3936. box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.15);
  3937. line-height: 16px;
  3938. }
  3939. .l7-button-control .l7-iconfont {
  3940. fill: #595959;
  3941. color: #595959;
  3942. width: 16px;
  3943. height: 16px;
  3944. }
  3945. .l7-button-control.l7-button-control--row {
  3946. padding: 0 16px 0 13px;
  3947. }
  3948. .l7-button-control.l7-button-control--row * + .l7-button-control__text {
  3949. margin-left: 8px;
  3950. }
  3951. .l7-button-control.l7-button-control--column {
  3952. height: 44px;
  3953. flex-direction: column;
  3954. }
  3955. .l7-button-control.l7-button-control--column .l7-iconfont {
  3956. margin-top: 3px;
  3957. }
  3958. .l7-button-control.l7-button-control--column .l7-button-control__text {
  3959. margin-top: 3px;
  3960. font-size: 10px;
  3961. -webkit-transform: scale(0.83333);
  3962. transform: scale(0.83333);
  3963. }
  3964. .l7-button-control:not(:disabled):hover {
  3965. background-color: #f3f3f3;
  3966. }
  3967. .l7-button-control:not(:disabled):active {
  3968. background-color: #f3f3f3;
  3969. }
  3970. .l7-button-control:disabled {
  3971. background-color: #fafafa;
  3972. color: #bdbdbd;
  3973. cursor: not-allowed;
  3974. }
  3975. .l7-button-control:disabled .l7-iconfont {
  3976. fill: #bdbdbd;
  3977. color: #bdbdbd;
  3978. }
  3979. .l7-button-control:disabled:hover {
  3980. background-color: #fafafa;
  3981. }
  3982. .l7-button-control:disabled:active {
  3983. background-color: #fafafa;
  3984. }
  3985. .l7-popper {
  3986. position: absolute;
  3987. display: flex;
  3988. justify-content: center;
  3989. align-items: center;
  3990. z-index: 5;
  3991. color: #595959;
  3992. }
  3993. .l7-popper.l7-popper-hide {
  3994. display: none;
  3995. }
  3996. .l7-popper .l7-popper-content {
  3997. min-height: 28px;
  3998. background: #fff;
  3999. border-radius: 2px;
  4000. box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.15);
  4001. }
  4002. .l7-popper .l7-popper-arrow {
  4003. width: 0;
  4004. height: 0;
  4005. border-width: 4px;
  4006. border-style: solid;
  4007. border-top-color: transparent;
  4008. border-bottom-color: transparent;
  4009. border-left-color: transparent;
  4010. border-right-color: transparent;
  4011. box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.15);
  4012. }
  4013. .l7-popper.l7-popper-left {
  4014. flex-direction: row;
  4015. }
  4016. .l7-popper.l7-popper-left .l7-popper-arrow {
  4017. border-left-color: #fff;
  4018. margin: 10px 0;
  4019. }
  4020. .l7-popper.l7-popper-right {
  4021. flex-direction: row-reverse;
  4022. }
  4023. .l7-popper.l7-popper-right .l7-popper-arrow {
  4024. border-right-color: #fff;
  4025. margin: 10px 0;
  4026. }
  4027. .l7-popper.l7-popper-top {
  4028. flex-direction: column;
  4029. }
  4030. .l7-popper.l7-popper-top .l7-popper-arrow {
  4031. border-top-color: #fff;
  4032. margin: 0 10px;
  4033. }
  4034. .l7-popper.l7-popper-bottom {
  4035. flex-direction: column-reverse;
  4036. }
  4037. .l7-popper.l7-popper-bottom .l7-popper-arrow {
  4038. border-bottom-color: #fff;
  4039. margin: 0 10px;
  4040. }
  4041. .l7-popper.l7-popper-start {
  4042. align-items: flex-start;
  4043. }
  4044. .l7-popper.l7-popper-end {
  4045. align-items: flex-end;
  4046. }
  4047. .l7-select-control--normal {
  4048. padding: 4px 0;
  4049. }
  4050. .l7-select-control--normal .l7-select-control-item {
  4051. display: flex;
  4052. align-items: center;
  4053. height: 24px;
  4054. padding: 0 16px;
  4055. font-size: 12px;
  4056. line-height: 24px;
  4057. }
  4058. .l7-select-control--normal .l7-select-control-item > * + * {
  4059. margin-left: 6px;
  4060. }
  4061. .l7-select-control--normal .l7-select-control-item input[type='checkbox'] {
  4062. width: 14px;
  4063. height: 14px;
  4064. }
  4065. .l7-select-control--normal .l7-select-control-item:hover {
  4066. background-color: #f3f3f3;
  4067. }
  4068. .l7-select-control--image {
  4069. display: flex;
  4070. flex-wrap: wrap;
  4071. align-items: flex-start;
  4072. box-sizing: content-box;
  4073. max-width: 460px;
  4074. max-height: 400px;
  4075. margin: 12px 0 0 12px;
  4076. overflow-x: hidden;
  4077. overflow-y: auto;
  4078. }
  4079. .l7-select-control--image .l7-select-control-item {
  4080. position: relative;
  4081. display: flex;
  4082. flex: 0 0 calc((100% - (12px + 9px) * 2) / 3);
  4083. flex-direction: column;
  4084. justify-content: center;
  4085. box-sizing: content-box;
  4086. margin-right: 12px;
  4087. margin-bottom: 12px;
  4088. overflow: hidden;
  4089. font-size: 12px;
  4090. border: 1px solid #fff;
  4091. border-radius: 2px;
  4092. }
  4093. .l7-select-control--image .l7-select-control-item img {
  4094. width: 100%;
  4095. height: 80px;
  4096. }
  4097. .l7-select-control--image .l7-select-control-item input[type='checkbox'] {
  4098. position: absolute;
  4099. top: 0;
  4100. right: 0;
  4101. }
  4102. .l7-select-control--image .l7-select-control-item .l7-select-control-item-row {
  4103. display: flex;
  4104. align-items: center;
  4105. justify-content: center;
  4106. line-height: 26px;
  4107. }
  4108. .l7-select-control--image .l7-select-control-item .l7-select-control-item-row > * + * {
  4109. margin-left: 8px;
  4110. }
  4111. .l7-select-control--image .l7-select-control-item.l7-select-control-item-active {
  4112. border-color: #0370fe;
  4113. }
  4114. .l7-select-control-item {
  4115. cursor: pointer;
  4116. }
  4117. .l7-select-control-item input[type='checkbox'] {
  4118. margin: 0;
  4119. cursor: pointer;
  4120. }
  4121. .l7-select-control--multiple .l7-select-control-item:hover {
  4122. background-color: transparent;
  4123. }
  4124. .l7-control-logo {
  4125. width: 89px;
  4126. height: 16px;
  4127. -webkit-user-select: none;
  4128. -moz-user-select: none;
  4129. -ms-user-select: none;
  4130. user-select: none;
  4131. }
  4132. .l7-control-logo img {
  4133. height: 100%;
  4134. width: 100%;
  4135. }
  4136. .l7-control-logo .l7-control-logo-link {
  4137. display: block;
  4138. cursor: pointer;
  4139. }
  4140. .l7-control-logo .l7-control-logo-link img {
  4141. cursor: pointer;
  4142. }
  4143. .l7-control-mouse-location {
  4144. background-color: #fff;
  4145. border-radius: 2px;
  4146. box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.15);
  4147. padding: 2px 4px;
  4148. min-width: 130px;
  4149. }
  4150. .l7-control-zoom {
  4151. overflow: hidden;
  4152. border-radius: 2px;
  4153. box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.15);
  4154. }
  4155. .l7-control-zoom .l7-button-control {
  4156. font-size: 16px;
  4157. border-bottom: 1px solid #f0f0f0;
  4158. border-radius: 0;
  4159. box-shadow: 0 0 0;
  4160. }
  4161. .l7-control-zoom .l7-button-control .l7-iconfont {
  4162. width: 14px;
  4163. height: 14px;
  4164. }
  4165. .l7-control-zoom .l7-button-control:last-child {
  4166. border-bottom: 0;
  4167. }
  4168. .l7-control-zoom .l7-control-zoom__number {
  4169. color: #595959;
  4170. padding: 0;
  4171. }
  4172. .l7-control-zoom .l7-control-zoom__number:hover {
  4173. background-color: #fff;
  4174. }
  4175. .l7-control-scale {
  4176. display: flex;
  4177. flex-direction: column;
  4178. }
  4179. .l7-control-scale .l7-control-scale-line {
  4180. box-sizing: border-box;
  4181. padding: 2px 5px 1px;
  4182. overflow: hidden;
  4183. color: #595959;
  4184. font-size: 10px;
  4185. line-height: 1.1;
  4186. white-space: nowrap;
  4187. background: #fff;
  4188. border: 2px solid #000;
  4189. border-top: 0;
  4190. transition: width 0.1s;
  4191. }
  4192. .l7-control-scale .l7-control-scale-line + .l7-control-scale .l7-control-scale-line {
  4193. margin-top: -2px;
  4194. border-top: 2px solid #777;
  4195. border-bottom: none;
  4196. }
  4197. .l7-right .l7-control-scale {
  4198. display: flex;
  4199. align-items: flex-end;
  4200. }
  4201. .l7-right .l7-control-scale .l7-control-scale-line {
  4202. text-align: right;
  4203. }
  4204. .l7-popup {
  4205. position: absolute;
  4206. top: 0;
  4207. left: 0;
  4208. z-index: 5;
  4209. display: flex;
  4210. will-change: transform;
  4211. pointer-events: none;
  4212. }
  4213. .l7-popup.l7-popup-hide {
  4214. display: none;
  4215. }
  4216. .l7-popup .l7-popup-content {
  4217. position: relative;
  4218. padding: 16px;
  4219. font-size: 14px;
  4220. background: #fff;
  4221. border-radius: 3px;
  4222. box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  4223. }
  4224. .l7-popup .l7-popup-content .l7-popup-content__title {
  4225. margin-bottom: 8px;
  4226. font-weight: bold;
  4227. }
  4228. .l7-popup .l7-popup-content .l7-popup-close-button,
  4229. .l7-popup .l7-popup-content .l7-popup-content__title,
  4230. .l7-popup .l7-popup-content .l7-popup-content__panel {
  4231. white-space: normal;
  4232. -webkit-user-select: text;
  4233. -moz-user-select: text;
  4234. -ms-user-select: text;
  4235. user-select: text;
  4236. pointer-events: initial;
  4237. }
  4238. .l7-popup .l7-popup-content .l7-popup-close-button {
  4239. position: absolute;
  4240. top: 0;
  4241. right: 0;
  4242. width: 18px;
  4243. height: 18px;
  4244. padding: 0;
  4245. font-size: 14px;
  4246. line-height: 18px;
  4247. text-align: center;
  4248. background-color: transparent;
  4249. border: 0;
  4250. border-radius: 0 3px 0 0;
  4251. cursor: pointer;
  4252. }
  4253. .l7-popup .l7-popup-tip {
  4254. position: relative;
  4255. z-index: 1;
  4256. width: 0;
  4257. height: 0;
  4258. border: 10px solid transparent;
  4259. }
  4260. .l7-popup.l7-popup-anchor-bottom,
  4261. .l7-popup.l7-popup-anchor-bottom-left,
  4262. .l7-popup.l7-popup-anchor-bottom-right {
  4263. flex-direction: column-reverse;
  4264. }
  4265. .l7-popup.l7-popup-anchor-bottom .l7-popup-tip,
  4266. .l7-popup.l7-popup-anchor-bottom-left .l7-popup-tip,
  4267. .l7-popup.l7-popup-anchor-bottom-right .l7-popup-tip {
  4268. bottom: 1px;
  4269. }
  4270. .l7-popup.l7-popup-anchor-top,
  4271. .l7-popup.l7-popup-anchor-top-left,
  4272. .l7-popup.l7-popup-anchor-top-right {
  4273. flex-direction: column;
  4274. }
  4275. .l7-popup.l7-popup-anchor-top .l7-popup-tip,
  4276. .l7-popup.l7-popup-anchor-top-left .l7-popup-tip,
  4277. .l7-popup.l7-popup-anchor-top-right .l7-popup-tip {
  4278. top: 1px;
  4279. }
  4280. .l7-popup.l7-popup-anchor-left {
  4281. flex-direction: row;
  4282. }
  4283. .l7-popup.l7-popup-anchor-right {
  4284. flex-direction: row-reverse;
  4285. }
  4286. .l7-popup-anchor-top .l7-popup-tip {
  4287. position: relative;
  4288. align-self: center;
  4289. border-top: none;
  4290. border-bottom-color: #fff;
  4291. }
  4292. .l7-popup-anchor-top-left .l7-popup-tip {
  4293. align-self: flex-start;
  4294. border-top: none;
  4295. border-bottom-color: #fff;
  4296. border-left: none;
  4297. }
  4298. .l7-popup-anchor-top-right .l7-popup-tip {
  4299. align-self: flex-end;
  4300. border-top: none;
  4301. border-right: none;
  4302. border-bottom-color: #fff;
  4303. }
  4304. .l7-popup-anchor-bottom .l7-popup-tip {
  4305. align-self: center;
  4306. border-top-color: #fff;
  4307. border-bottom: none;
  4308. }
  4309. .l7-popup-anchor-bottom-left .l7-popup-tip {
  4310. align-self: flex-start;
  4311. border-top-color: #fff;
  4312. border-bottom: none;
  4313. border-left: none;
  4314. }
  4315. .l7-popup-anchor-bottom-right .l7-popup-tip {
  4316. align-self: flex-end;
  4317. border-top-color: #fff;
  4318. border-right: none;
  4319. border-bottom: none;
  4320. }
  4321. .l7-popup-anchor-left .l7-popup-tip {
  4322. align-self: center;
  4323. border-right-color: #fff;
  4324. border-left: none;
  4325. }
  4326. .l7-popup-anchor-right .l7-popup-tip {
  4327. right: 1px;
  4328. align-self: center;
  4329. border-right: none;
  4330. border-left-color: #fff;
  4331. }
  4332. .l7-popup-anchor-top-left .l7-popup-content {
  4333. border-top-left-radius: 0;
  4334. }
  4335. .l7-popup-anchor-top-right .l7-popup-content {
  4336. border-top-right-radius: 0;
  4337. }
  4338. .l7-popup-anchor-bottom-left .l7-popup-content {
  4339. border-bottom-left-radius: 0;
  4340. }
  4341. .l7-popup-anchor-bottom-right .l7-popup-content {
  4342. border-bottom-right-radius: 0;
  4343. }
  4344. .l7-popup-track-pointer {
  4345. display: none;
  4346. }
  4347. .l7-popup-track-pointer * {
  4348. -webkit-user-select: none;
  4349. -moz-user-select: none;
  4350. -ms-user-select: none;
  4351. user-select: none;
  4352. pointer-events: none;
  4353. }
  4354. .l7-map:hover .l7-popup-track-pointer {
  4355. display: flex;
  4356. }
  4357. .l7-map:active .l7-popup-track-pointer {
  4358. display: none;
  4359. }
  4360. .l7-layer-popup__row {
  4361. font-size: 12px;
  4362. }
  4363. .l7-layer-popup__row + .l7-layer-popup__row {
  4364. margin-top: 4px;
  4365. }
  4366. .l7-control-swipe {
  4367. position: absolute;
  4368. top: 50%;
  4369. left: 50%;
  4370. z-index: 6;
  4371. -webkit-transform: translate(-50%, -50%);
  4372. transform: translate(-50%, -50%);
  4373. touch-action: none;
  4374. }
  4375. .l7-control-swipe_hide {
  4376. display: none;
  4377. }
  4378. .l7-control-swipe:before {
  4379. position: absolute;
  4380. top: -5000px;
  4381. bottom: -5000px;
  4382. left: 50%;
  4383. z-index: -1;
  4384. width: 4px;
  4385. background: #fff;
  4386. -webkit-transform: translate(-2px, 0);
  4387. transform: translate(-2px, 0);
  4388. content: '';
  4389. }
  4390. .l7-control-swipe.horizontal:before {
  4391. top: 50%;
  4392. right: -5000px;
  4393. bottom: auto;
  4394. left: -5000px;
  4395. width: auto;
  4396. height: 4px;
  4397. }
  4398. .l7-control-swipe__button {
  4399. display: block;
  4400. width: 28px;
  4401. height: 28px;
  4402. margin: 0;
  4403. padding: 0;
  4404. color: #595959;
  4405. font-weight: bold;
  4406. font-size: inherit;
  4407. text-align: center;
  4408. text-decoration: none;
  4409. background-color: #fff;
  4410. border: none;
  4411. border-radius: 2px;
  4412. outline: none;
  4413. }
  4414. .l7-control-swipe,
  4415. .l7-control-swipe__button {
  4416. cursor: ew-resize;
  4417. }
  4418. .l7-control-swipe.horizontal,
  4419. .l7-control-swipe.horizontal button {
  4420. cursor: ns-resize;
  4421. }
  4422. .l7-control-swipe:after,
  4423. .l7-control-swipe__button:before,
  4424. .l7-control-swipe__button:after {
  4425. position: absolute;
  4426. top: 25%;
  4427. bottom: 25%;
  4428. left: 50%;
  4429. width: 2px;
  4430. background: currentColor;
  4431. -webkit-transform: translate(-1px, 0);
  4432. transform: translate(-1px, 0);
  4433. content: '';
  4434. }
  4435. .l7-control-swipe__button:after {
  4436. -webkit-transform: translateX(4px);
  4437. transform: translateX(4px);
  4438. }
  4439. .l7-control-swipe__button:before {
  4440. -webkit-transform: translateX(-6px);
  4441. transform: translateX(-6px);
  4442. }
  4443. `);class qZ{constructor(t){E(this,"configService",void 0),E(this,"config",void 0),this.config=t}setContainer(t,r){this.configService=t.globalConfigService,t.mapConfig=he(he({},this.config),{},{id:r}),t.mapService=new(this.getServiceConstructor())(t)}getServiceConstructor(){throw new Error("Method not implemented.")}}var ZS={exports:{}};(function(e,t){(function(r,n){e.exports=n()})(mo,function(){function r(c){var h=[];return c.AMapUI&&h.push(n(c.AMapUI)),c.Loca&&h.push(i(c.Loca)),Promise.all(h)}function n(c){return new Promise(function(h,d){var p=[];if(c.plugins)for(var v=0;v<c.plugins.length;v+=1)a.AMapUI.plugins.indexOf(c.plugins[v])==-1&&p.push(c.plugins[v]);if(s.AMapUI===o.failed)d("前次请求 AMapUI 失败");else if(s.AMapUI===o.notload){s.AMapUI=o.loading,a.AMapUI.version=c.version||a.AMapUI.version,v=a.AMapUI.version;var g=document.body||document.head,y=document.createElement("script");y.type="text/javascript",y.src="https://webapi.amap.com/ui/"+v+"/main.js",y.onerror=function(S){s.AMapUI=o.failed,d("请求 AMapUI 失败")},y.onload=function(){if(s.AMapUI=o.loaded,p.length)window.AMapUI.loadUI(p,function(){for(var S=0,R=p.length;S<R;S++){var x=p[S].split("/").slice(-1)[0];window.AMapUI[x]=arguments[S]}for(h();u.AMapUI.length;)u.AMapUI.splice(0,1)[0]()});else for(h();u.AMapUI.length;)u.AMapUI.splice(0,1)[0]()},g.appendChild(y)}else s.AMapUI===o.loaded?c.version&&c.version!==a.AMapUI.version?d("不允许多个版本 AMapUI 混用"):p.length?window.AMapUI.loadUI(p,function(){for(var S=0,R=p.length;S<R;S++){var x=p[S].split("/").slice(-1)[0];window.AMapUI[x]=arguments[S]}h()}):h():c.version&&c.version!==a.AMapUI.version?d("不允许多个版本 AMapUI 混用"):u.AMapUI.push(function(S){S?d(S):p.length?window.AMapUI.loadUI(p,function(){for(var R=0,x=p.length;R<x;R++){var M=p[R].split("/").slice(-1)[0];window.AMapUI[M]=arguments[R]}h()}):h()})})}function i(c){return new Promise(function(h,d){if(s.Loca===o.failed)d("前次请求 Loca 失败");else if(s.Loca===o.notload){s.Loca=o.loading,a.Loca.version=c.version||a.Loca.version;var p=a.Loca.version,v=a.AMap.version.startsWith("2"),g=p.startsWith("2");if(v&&!g||!v&&g)d("JSAPI 与 Loca 版本不对应!!");else{v=a.key,g=document.body||document.head;var y=document.createElement("script");y.type="text/javascript",y.src="https://webapi.amap.com/loca?v="+p+"&key="+v,y.onerror=function(S){s.Loca=o.failed,d("请求 AMapUI 失败")},y.onload=function(){for(s.Loca=o.loaded,h();u.Loca.length;)u.Loca.splice(0,1)[0]()},g.appendChild(y)}}else s.Loca===o.loaded?c.version&&c.version!==a.Loca.version?d("不允许多个版本 Loca 混用"):h():c.version&&c.version!==a.Loca.version?d("不允许多个版本 Loca 混用"):u.Loca.push(function(S){S?d(S):d()})})}if(!window)throw Error("AMap JSAPI can only be used in Browser.");var o;(function(c){c.notload="notload",c.loading="loading",c.loaded="loaded",c.failed="failed"})(o||(o={}));var a={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},s={AMap:o.notload,AMapUI:o.notload,Loca:o.notload},u={AMap:[],AMapUI:[],Loca:[]},l=[],f=function(c){typeof c=="function"&&(s.AMap===o.loaded?c(window.AMap):l.push(c))};return{load:function(c){return new Promise(function(h,d){if(s.AMap==o.failed)d("");else if(s.AMap==o.notload){var p=c.key,v=c.version,g=c.plugins;p?(window.AMap&&location.host!=="lbs.amap.com"&&d("禁止多种API加载方式混用"),a.key=p,a.AMap.version=v||a.AMap.version,a.AMap.plugins=g||a.AMap.plugins,s.AMap=o.loading,v=document.body||document.head,window.___onAPILoaded=function(S){if(delete window.___onAPILoaded,S)s.AMap=o.failed,d(S);else for(s.AMap=o.loaded,r(c).then(function(){h(window.AMap)}).catch(d);l.length;)l.splice(0,1)[0]()},g=document.createElement("script"),g.type="text/javascript",g.src="https://webapi.amap.com/maps?callback=___onAPILoaded&v="+a.AMap.version+"&key="+p+"&plugin="+a.AMap.plugins.join(","),g.onerror=function(S){s.AMap=o.failed,d(S)},v.appendChild(g)):d("请填写key")}else if(s.AMap==o.loaded)if(c.key&&c.key!==a.key)d("多个不一致的 key");else if(c.versi
  4444. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ln(e,t){return rq(e)||nq(e,t)||kR(e,t)||iq()}function uu(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function tc(e,t){var r=$p([],t,e);return P9(r,r,1/r[3]),r}function Co(e,t){if(!e)throw new Error(t||"viewport-mercator-project: assertion failed.")}var Yn=Math.PI,qS=Yn/4,Xi=Yn/180,E1=180/Yn,o_=512,y1=4003e4,oq=1.5;function KS(e){return Math.pow(2,e)}function td(e,t){var r=Ln(e,2),n=r[0],i=r[1];Co(Number.isFinite(n)&&Number.isFinite(t)),Co(Number.isFinite(i)&&i>=-90&&i<=90,"invalid latitude"),t*=o_;var o=n*Xi,a=i*Xi,s=t*(o+Yn)/(2*Yn),u=t*(Yn-Math.log(Math.tan(qS+a*.5)))/(2*Yn);return[s,u]}function T1(e,t){var r=Ln(e,2),n=r[0],i=r[1];t*=o_;var o=n/t*(2*Yn)-Yn,a=2*(Math.atan(Math.exp(Yn-i/t*(2*Yn)))-qS);return[o*E1,a*E1]}function aq(e){var t=e.latitude,r=e.longitude,n=e.zoom,i=e.scale,o=e.highPrecision,a=o===void 0?!1:o;i=i!==void 0?i:KS(n),Co(Number.isFinite(t)&&Number.isFinite(r)&&Number.isFinite(i));var s={},u=o_*i,l=Math.cos(t*Xi),f=u/360,c=f/l,h=u/y1/l;if(s.pixelsPerMeter=[h,-h,h],s.metersPerPixel=[1/h,-1/h,1/h],s.pixelsPerDegree=[f,-c,h],s.degreesPerPixel=[1/f,-1/c,1/h],a){var d=Xi*Math.tan(t*Xi)/l,p=f*d/2,v=u/y1*d,g=v/c*h;s.pixelsPerDegree2=[0,-p,v],s.pixelsPerMeter2=[g,0,g]}return s}function sq(e){var t=e.height,r=e.pitch,n=e.bearing,i=e.altitude,o=e.center,a=o===void 0?null:o,s=e.flipY,u=s===void 0?!1:s,l=uu();return mc(l,l,[0,0,-i]),gc(l,l,[1,1,1/t]),kp(l,l,-r*Xi),fA(l,l,n*Xi),u&&gc(l,l,[1,-1,1]),a&&mc(l,l,O9([],a)),l}function uq(e){var t=e.width,r=e.height,n=e.altitude,i=n===void 0?oq:n,o=e.pitch,a=o===void 0?0:o,s=e.nearZMultiplier,u=s===void 0?1:s,l=e.farZMultiplier,f=l===void 0?1:l,c=a*Xi,h=Math.atan(.5/i),d=Math.sin(h)*i/Math.sin(Math.PI/2-c-h),p=Math.cos(Math.PI/2-c)*d+i;return{fov:2*Math.atan(r/2/i),aspect:t/r,focalDistance:i,near:u,far:p*f}}function lq(e){var t=e.width,r=e.height,n=e.pitch,i=e.altitude,o=e.nearZMultiplier,a=e.farZMultiplier,s=uq({width:t,height:r,altitude:i,pitch:n,nearZMultiplier:o,farZMultiplier:a}),u=s.fov,l=s.aspect,f=s.near,c=s.far,h=R9([],u,l,f,c);return h}function cq(e,t){var r=Ln(e,3),n=r[0],i=r[1],o=r[2],a=o===void 0?0:o;return Co(Number.isFinite(n)&&Number.isFinite(i)&&Number.isFinite(a)),tc(t,[n,i,a,1])}function QS(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=Ln(e,3),i=n[0],o=n[1],a=n[2];if(Co(Number.isFinite(i)&&Number.isFinite(o),"invalid pixel coordinate"),Number.isFinite(a)){var s=tc(t,[i,o,a,1]);return s}var u=tc(t,[i,o,0,1]),l=tc(t,[i,o,1,1]),f=u[2],c=l[2],h=f===c?0:((r||0)-f)/(c-f);return F9([],u,l,h)}var A1=uu(),fq=function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=t.width,n=t.height,i=t.viewMatrix,o=i===void 0?A1:i,a=t.projectionMatrix,s=a===void 0?A1:a;cy(this,e),this.width=r||1,this.height=n||1,this.scale=1,this.pixelsPerMeter=1,this.viewMatrix=o,this.projectionMatrix=s;var u=uu();Oa(u,u,this.projectionMatrix),Oa(u,u,this.viewMatrix),this.viewProjectionMatrix=u;var l=uu();gc(l,l,[this.width/2,-this.height/2,1]),mc(l,l,[1,-1,0]),Oa(l,l,this.viewProjectionMatrix);var f=lA(uu(),l);if(!f)throw new Error("Pixel project matrix not invertible");this.pixelProjectionMatrix=l,this.pixelUnprojectionMatrix=f,this.equals=this.equals.bind(this),this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectPosition=this.projectPosition.bind(this),this.unprojectPosition=this.unprojectPosition.bind(this),this.projectFlat=this.projectFlat.bind(this),this.unprojectFlat=this.unprojectFlat.bind(this)}return ly(e,[{key:"equals",value:function(r){return r instanceof e?r.width===this.width&&r.height===this.height&&lg(r.projectionMatrix,this.projectionMatrix)&&lg(r.viewMatrix,this.viewMatrix):!1}},{key:"project",value:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=n.topLeft,o=i===void 0?!0:i,a=this.projectPosition(r),s=cq(a,this.pixelProjectionMatrix),u=Ln(s,2),l=u[0],f=u[1],c=o?f:this.height-f;return r.length===2?[l,c]:[l,c,s[2]]}},{key:"unproject",value:function(r){var n=argumen
  4445. display: none !important;
  4446. }
  4447. .amap-copyright {
  4448. display: none !important;
  4449. }
  4450. .amap-overlays {
  4451. z-index: 3 !important;
  4452. }
  4453. `);const gq="2.0",x1="f59bcf249433f8b05caaee19f349b3d7",po=1,b1={contextmenu:"rightclick",camerachange:"viewchange"};class Eq extends tq{constructor(...t){super(...t),E(this,"viewport",new dq),E(this,"version",pq.GAODE),E(this,"handleCameraChanged",()=>{const r=this.getViewState();this.updateView(r)})}getType(){return"amap"}init(){var t=this;return ve(function*(){const r=t.config,{id:n,style:i="light",minZoom:o=0,maxZoom:a=24,token:s=x1,mapInstance:u,plugin:l=[]}=r,f=ai(r,vq);if(window.AMap||u||(l.push("Map3D"),yield QZ.load({key:s,version:gq,plugins:l})),u)t.map=u,t.mapContainer=t.map.getContainer(),t.map.on("viewchange",t.handleCameraChanged);else{const c=he({mapStyle:t.getMapStyleValue(i),zooms:[o,a],viewMode:"3D"},f);if(c.zoom&&(c.zoom+=po),s===x1&&(window._AMapSecurityConfig={securityJsCode:"2653011adeb04230b3a26cc9a780a800"},console.warn(`%c${t.configService.getSceneWarninfo("MapToken")}!`,"color: #873bf4;font-weigh:900;font-size: 16px;")),!n)throw Error("No container id specified");window.forceWebGL=!0,t.mapContainer=t.creatMapContainer(n);const h=new AMap.Map(t.mapContainer,c);t.map=h,h.on("viewchange",t.handleCameraChanged)}t.syncInitViewPort()})()}syncInitViewPort(){const t=this.getViewState();this.updateView(t)}getViewState(){const{center:t,zoom:r}=yq(this.map);return{center:t,viewportWidth:this.map.getContainer().clientWidth,viewportHeight:this.map.getContainer().clientHeight,bearing:-this.map.getRotation(),pitch:this.map.getPitch(),zoom:r-po}}creatMapContainer(t){const r=super.creatMapContainer(t),n=document.createElement("div");return n.style.cssText+=`
  4454. position: absolute;
  4455. top: 0;
  4456. height: 100%;
  4457. width: 100%;
  4458. `,n.id=Sr.uniqueId("l7_amap_div"),r.appendChild(n),n}getContainer(){return this.map.getContainer()}addMarkerContainer(){if(!this.map)return;const t=this.map.getContainer();if(t!==null){const r=t.getElementsByClassName("amap-maps")[0];r.style.zIndex="auto",this.markerContainer=yn("div","l7-marker-container2",r)}}getMarkerContainer(){return this.markerContainer}getCanvasOverlays(){var t;return(t=this.mapContainer)===null||t===void 0?void 0:t.querySelector(".amap-overlays")}on(t,r){Jm.indexOf(t)!==-1?this.eventEmitter.on(t,r):this.map.on(b1[t]||t,r)}off(t,r){Jm.indexOf(t)!==-1?this.eventEmitter.off(t,r):this.map.off(b1[t]||t,r)}getSize(){const t=this.map.getSize();return[t.getWidth(),t.getHeight()]}getMinZoom(){return this.map.getZooms()[0]-po}getMaxZoom(){return this.map.getZooms()[1]-po}getZoom(){return this.map.getZoom()-po}getCenter(t){if(t!=null&&t.padding){const n=this.getCenter(),i=S1(t.padding),o=this.lngLatToPixel([n.lng,n.lat]),a=[(i.right-i.left)/2,(i.bottom-i.top)/2];return this.pixelToLngLat([o.x-a[0],o.y-a[1]])}const r=this.map.getCenter();return{lng:r.getLng(),lat:r.getLat()}}getPitch(){return this.map.getPitch()}getRotation(){return 360-this.map.getRotation()}getBounds(){const t=this.map.getBounds(),r=t.getNorthEast(),n=t.getSouthWest(),i=this.getCenter(),o=i.lng>r.getLng()||i.lng<n.getLng()?180-r.getLng():r.getLng();return[[i.lng<n.getLng()?n.getLng()-180:n.getLng(),n.getLat()],[o,r.getLat()]]}getMapContainer(){return this.mapContainer}getMapCanvasContainer(){var t;return(t=this.map.getContainer())===null||t===void 0?void 0:t.getElementsByClassName("amap-maps")[0]}getMapStyleConfig(){return _q}getMapStyleValue(t){return this.getMapStyleConfig()[t]||t}getMapStyle(){return this.map.getMapStyle()}setMapStyle(t){this.map.setMapStyle(this.getMapStyleValue(t))}setRotation(t){return this.map.setRotation(t)}zoomIn(){this.map.zoomIn()}zoomOut(){this.map.zoomOut()}panTo(t){this.map.panTo(t)}panBy(t=0,r=0){this.map.panBy(t,r)}fitBounds(t){this.map.setBounds(new AMap.Bounds([t[0][0],t[0][1],t[1][0],t[1][1]]),!0)}setZoomAndCenter(t,r){this.map.setZoomAndCenter(t+po,r)}setCenter(t,r){if(r!=null&&r.padding){const n=S1(r.padding),i=this.lngLatToPixel(t),o=[(n.right-n.left)/2,(n.bottom-n.top)/2],a=this.pixelToLngLat([i.x+o[0],i.y+o[1]]);this.map.setCenter([a.lng,a.lat])}else this.map.setCenter(t)}setPitch(t){return this.map.setPitch(t)}setZoom(t){return this.map.setZoom(t+po)}setMaxZoom(t){throw new Error("Method not implemented.")}setMinZoom(t){throw new Error("Method not implemented.")}setMapStatus(t){this.map.setStatus(t)}meterToCoord(t,r){const n=AMap.GeometryUtil.distance(new AMap.LngLat(...t),new AMap.LngLat(...r)),[i,o]=Ph(...t),[a,s]=Ph(...r);return Math.sqrt(Math.pow(i-a,2)+Math.pow(o-s,2))/n}pixelToLngLat(t){const r=this.map.pixelToLngLat(new AMap.Pixel(t[0],t[1]));return{lng:r.getLng(),lat:r.getLat()}}lngLatToPixel(t){const r=this.map.lnglatToPixel(t);return{x:r.getX(),y:r.getY()}}containerToLngLat(t){const r=new AMap.Pixel(t[0],t[1]),n=this.map.containerToLngLat(r);return{lng:n==null?void 0:n.getLng(),lat:n==null?void 0:n.getLat()}}lngLatToContainer(t){const r=this.map.lngLatToContainer(t);return{x:r.getX(),y:r.getY()}}lngLatToMercator([t,r],n){const[i,o]=Ph(t,r);return{x:i,y:o,z:n}}getModelMatrix(t,r,n,i=[1,1,1]){const o=this.viewport.projectFlat(t),a=Up();return mc(a,a,Wn(o[0],o[1],r)),gc(a,a,Wn(i[0],i[1],i[2])),kp(a,a,n[0]),cA(a,a,n[1]),fA(a,a,n[2]),a}exportMap(t){var r;const n=(r=this.getContainer())===null||r===void 0?void 0:r.getElementsByClassName("amap-layer")[0];return t==="jpg"?n==null?void 0:n.toDataURL("image/jpeg"):n==null?void 0:n.toDataURL("image/png")}destroy(){var t;super.destroy(),(t=this.mapContainer)===null||t===void 0||(t=t.parentNode)===null||t===void 0||t.removeChild(this.mapContainer),delete window.initAMap;const r=document.getElementById("amap-script");r&&document.head.removeChild(r),this.map.destroy()}}function yq(e){const t=e._view.getOptions(),r=t.center,n=t.zoom;return{center:r,zoom:n}}class Tq extends qZ{getServiceConstructor(){return Eq}}const R1=Tq;var wn=function(e){return
  4459. `);return r.map(function(n,i){return"".concat(Pq(""+(t+i),4," ")," ").concat(n)}).join(`
  4460. `)}function Pq(e,t,r){for(;e.length<t;)e="".concat(r).concat(e);return e}function O1(e,t){e.blendDstFactor=t.blendDstFactor,e.blendSrcFactor=t.blendSrcFactor,e.blendMode=t.blendMode}function zc(e,t){return e===void 0&&(e={}),e.compare=t.compare,e.depthFailOp=t.depthFailOp,e.passOp=t.passOp,e.failOp=t.failOp,e.mask=t.mask,e}function sx(e,t){return e===void 0&&(e={rgbBlendState:{},alphaBlendState:{},channelWriteMask:0}),O1(e.rgbBlendState,t.rgbBlendState),O1(e.alphaBlendState,t.alphaBlendState),e.channelWriteMask=t.channelWriteMask,e}function ux(e,t){e.length!==t.length&&(e.length=t.length);for(var r=0;r<t.length;r++)e[r]=sx(e[r],t[r])}function Lq(e,t){t.attachmentsState!==void 0&&ux(e.attachmentsState,t.attachmentsState),e.blendConstant&&t.blendConstant&&ox(e.blendConstant,t.blendConstant),e.depthCompare=Fi(t.depthCompare,e.depthCompare),e.depthWrite=Fi(t.depthWrite,e.depthWrite),e.stencilWrite=Fi(t.stencilWrite,e.stencilWrite),e.stencilFront&&t.stencilFront&&zc(e.stencilFront,t.stencilFront),e.stencilBack&&t.stencilBack&&zc(e.stencilBack,t.stencilBack),e.cullMode=Fi(t.cullMode,e.cullMode),e.frontFace=Fi(t.frontFace,e.frontFace),e.polygonOffset=Fi(t.polygonOffset,e.polygonOffset),e.polygonOffsetFactor=Fi(t.polygonOffsetFactor,e.polygonOffsetFactor),e.polygonOffsetUnits=Fi(t.polygonOffsetUnits,e.polygonOffsetUnits)}function $a(e){var t=Object.assign({},e);return t.attachmentsState=[],ux(t.attachmentsState,e.attachmentsState),t.blendConstant=t.blendConstant&&ax(t.blendConstant),t.stencilFront=zc(void 0,e.stencilFront),t.stencilBack=zc(void 0,e.stencilBack),t}var I1={blendMode:wr.ADD,blendSrcFactor:xt.ONE,blendDstFactor:xt.ZERO},za={attachmentsState:[{channelWriteMask:Lr.ALL,rgbBlendState:I1,alphaBlendState:I1}],blendConstant:ax(vf),depthWrite:!0,depthCompare:kt.LEQUAL,stencilWrite:!1,stencilFront:{compare:kt.ALWAYS,passOp:ar.KEEP,depthFailOp:ar.KEEP,failOp:ar.KEEP},stencilBack:{compare:kt.ALWAYS,passOp:ar.KEEP,depthFailOp:ar.KEEP,failOp:ar.KEEP},cullMode:pn.NONE,frontFace:Cu.CCW,polygonOffset:!1,polygonOffsetFactor:0,polygonOffsetUnits:0};function wq(e,t){e===void 0&&(e=null),t===void 0&&(t=za);var r=$a(t);return e!==null&&Lq(r,e),r}wq({depthCompare:kt.ALWAYS,depthWrite:!1},za);var lx={texture:null,sampler:null,formatKind:or.Float,dimension:bt.TEXTURE_2D};function Hi(e,t,r){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!r(e[n],t[n]))return!1;return!0}function Ta(e,t){for(var r=Array(e.length),n=0;n<e.length;n++)r[n]=t(e[n]);return r}function Fq(e,t){return e.texture===t.texture&&e.binding===t.binding}function M1(e,t){return e.buffer===t.buffer&&e.size===t.size&&e.binding===t.binding&&e.offset===t.offset}function Bq(e,t){return e===null?t===null:t===null?!1:e.sampler===t.sampler&&e.texture===t.texture&&e.dimension===t.dimension&&e.formatKind===t.formatKind&&e.comparison===t.comparison}function Dq(e,t){return e.samplerBindings=e.samplerBindings||[],e.uniformBufferBindings=e.uniformBufferBindings||[],e.storageBufferBindings=e.storageBufferBindings||[],e.storageTextureBindings=e.storageTextureBindings||[],t.samplerBindings=t.samplerBindings||[],t.uniformBufferBindings=t.uniformBufferBindings||[],t.storageBufferBindings=t.storageBufferBindings||[],t.storageTextureBindings=t.storageTextureBindings||[],!(e.samplerBindings.length!==t.samplerBindings.length||!Hi(e.samplerBindings,t.samplerBindings,Bq)||!Hi(e.uniformBufferBindings,t.uniformBufferBindings,M1)||!Hi(e.storageBufferBindings,t.storageBufferBindings,M1)||!Hi(e.storageTextureBindings,t.storageTextureBindings,Fq))}function N1(e,t){return e.blendMode==t.blendMode&&e.blendSrcFactor===t.blendSrcFactor&&e.blendDstFactor===t.blendDstFactor}function Uq(e,t){return!(!N1(e.rgbBlendState,t.rgbBlendState)||!N1(e.alphaBlendState,t.alphaBlendState)||e.channelWriteMask!==t.channelWriteMask)}function Vc(e,t){return e.compare==t.compare&&e.depthFailOp===t.depthFailOp&&e.failOp===t.failOp&&e.passOp===t.passOp&&e.mask===t.mask}function kq(e,t){return!Hi(e.attachmentsState,t.attachmentsState,Uq)||e.blendConstant&&t.blendConstant&&!ix(e.blendConstant,t.blendConstant)||e.stenci
  4461. `,`
  4462. `).split(`
  4463. `).map(function($){return $.replace(/[/][/].*$/,"")}).filter(function($){var F=!$||/^\s+$/.test($);return!F}),l="";n!==null&&(l=Object.keys(n).map(function($){return Hs($,n[$])}).join(`
  4464. `));var f=u.find(function($){return $.startsWith("precision")})||"precision mediump float;",c=i?u.filter(function($){return!$.startsWith("precision")}).join(`
  4465. `):u.join(`
  4466. `),h="";if(e.viewportOrigin===Zn.UPPER_LEFT&&(h+="".concat(Hs("VIEWPORT_ORIGIN_TL","1"),`
  4467. `)),e.clipSpaceNearZ===Ua.ZERO&&(h+="".concat(Hs("CLIPSPACE_NEAR_ZERO","1"),`
  4468. `)),e.explicitBindingLocations){var d=0,p=0,v=0;c=c.replace(/^\s*(layout\((.*)\))?\s*uniform(.+{)$/gm,function($,F,Y,ge){var q=Y?"".concat(Y,", "):"";return"layout(".concat(q,"set = ").concat(d,", binding = ").concat(p++,") uniform ").concat(ge)}),d++,p=0,ht(e.separateSamplerTextures),c=c.replace(/^\s*(layout\((.*)\))?\s*uniform sampler(\w+) (.*);/gm,function($,F,Y,ge,q){var k=F1(Y);k===null&&(k=p++);var G=Xn(B1(ge),2),K=G[0],ce=G[1];return t==="frag"?`
  4469. layout(set = `.concat(d,", binding = ").concat(k*2+0,") uniform texture").concat(K," T_").concat(q,`;
  4470. layout(set = `).concat(d,", binding = ").concat(k*2+1,") uniform sampler").concat(ce," S_").concat(q,";").trim():""}),c=c.replace(t==="frag"?/^\s*\b(varying|in)\b/gm:/^\s*\b(varying|out)\b/gm,function($,F){return"layout(location = ".concat(v++,") ").concat(F)}),h+="".concat(Hs("gl_VertexID","gl_VertexIndex"),`
  4471. `),h+="".concat(Hs("gl_InstanceID","gl_InstanceIndex"),`
  4472. `),f=f.replace(/^precision (.*) sampler(.*);$/gm,"")}else{var g=0;c=c.replace(/^\s*(layout\((.*)\))?\s*uniform sampler(\w+) (.*);/gm,function($,F,Y,ge,q){var k=F1(Y);return k===null&&(k=g++),"uniform sampler".concat(ge," ").concat(q,"; // BINDING=").concat(k)})}if(c=c.replace(/\bPU_SAMPLER_(\w+)\((.*?)\)/g,function($,F,Y){return"SAMPLER_".concat(F,"(P_").concat(Y,")")}),c=c.replace(/\bPF_SAMPLER_(\w+)\((.*?)\)/g,function($,F,Y){return"PP_SAMPLER_".concat(F,"(P_").concat(Y,")")}),c=c.replace(/\bPU_TEXTURE\((.*?)\)/g,function($,F){return"TEXTURE(P_".concat(F,")")}),e.separateSamplerTextures)c=c.replace(/\bPD_SAMPLER_(\w+)\((.*?)\)/g,function($,F,Y){var ge=Xn(B1(F),2),q=ge[0],k=ge[1];return"texture".concat(q," T_P_").concat(Y,", sampler").concat(k," S_P_").concat(Y)}),c=c.replace(/\bPP_SAMPLER_(\w+)\((.*?)\)/g,function($,F,Y){return"T_".concat(Y,", S_").concat(Y)}),c=c.replace(/\bSAMPLER_(\w+)\((.*?)\)/g,function($,F,Y){return"sampler".concat(F,"(T_").concat(Y,", S_").concat(Y,")")}),c=c.replace(/\bTEXTURE\((.*?)\)/g,function($,F){return"T_".concat(F)});else{var y=[];c=c.replace(/\bPD_SAMPLER_(\w+)\((.*?)\)/g,function($,F,Y){return"sampler".concat(F," P_").concat(Y)}),c=c.replace(/\bPP_SAMPLER_(\w+)\((.*?)\)/g,function($,F,Y){return Y}),c=c.replace(/\bSAMPLER_(\w+)\((.*?)\)/g,function($,F,Y){return y.push([Y,F]),Y}),a&&y.forEach(function($){var F=Xn($,2),Y=F[0],ge=F[1];c=c.replace(new RegExp("texture\\(".concat(Y),"g"),function(){return"texture".concat(ge,"(").concat(Y)})}),c=c.replace(/\bTEXTURE\((.*?)\)/g,function($,F){return F})}var S="".concat(a?"":e.glslVersion,`
  4473. `).concat(a&&s?`#extension GL_EXT_draw_buffers : require
  4474. `:"",`
  4475. `).concat(a&&t==="frag"?`#extension GL_OES_standard_derivatives : enable
  4476. `:"").concat(i?f:"",`
  4477. `).concat(h||"").concat(l?l+`
  4478. `:"",`
  4479. `).concat(c,`
  4480. `).trim();if(e.explicitBindingLocations&&t==="frag"&&(S=S.replace(/^\b(out)\b/g,function($,F){return"layout(location = 0) ".concat(F)})),a){if(t==="frag"&&(S=S.replace(/^\s*in\s+(\S+)\s*(.*);$/gm,function($,F,Y){return"varying ".concat(F," ").concat(Y,`;
  4481. `)})),t==="vert"&&(S=S.replace(/^\s*out\s+(\S+)\s*(.*);$/gm,function($,F,Y){return"varying ".concat(F," ").concat(Y,`;
  4482. `)}),S=S.replace(/^\s*layout\(location\s*=\s*\S*\)\s*in\s+(\S+)\s*(.*);$/gm,function($,F,Y){return"attribute ".concat(F," ").concat(Y,`;
  4483. `)})),S=S.replace(/\s*uniform\s*.*\s*{((?:\s*.*\s*)*?)};/g,function($,F){return F.trim().replace(/^.*$/gm,function(Y){var ge=Y.trim();return ge.startsWith("#")?ge:Y?"uniform ".concat(ge):""})}),t==="frag")if(s){var R=[];S=S.replace(/^\s*layout\(location\s*=\s*\d*\)\s*out\s+vec4\s*(.*);$/gm,function($,F){return R.push(F),"vec4 ".concat(F,`;
  4484. `)});var x=S.lastIndexOf("}");S=S.substring(0,x)+`
  4485. `.concat(R.map(function($,F){return"gl_FragData[".concat(F,"] = ").concat($,`;
  4486. `)}).join(`
  4487. `))+S.substring(x)}else{var M;if(S=S.replace(/^\s*out\s+(\S+)\s*(.*);$/gm,function($,F,Y){return M=Y,"".concat(F," ").concat(Y,`;
  4488. `)}),M){var x=S.lastIndexOf("}");S=S.substring(0,x)+`
  4489. gl_FragColor = vec4(`.concat(M,`);
  4490. `)+S.substring(x)}}S=S.replace(/^\s*layout\((.*)\)/gm,"")}return S}var kn=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=e.call(this)||this;return o.id=n,o.device=i,o.device.resourceCreationTracker!==null&&o.device.resourceCreationTracker.trackResourceCreated(o),o}return t.prototype.destroy=function(){this.device.resourceCreationTracker!==null&&this.device.resourceCreationTracker.trackResourceDestroyed(this)},t}(ex),uK=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=r.descriptor,a=e.call(this,{id:n,device:i})||this;a.type=Lt.Bindings;var s=o.uniformBufferBindings,u=o.samplerBindings;return a.uniformBufferBindings=s||[],a.samplerBindings=u||[],a.bindingLayouts=a.createBindingLayouts(),a}return t.prototype.createBindingLayouts=function(){var r=0,n=0,i=[],o=this.uniformBufferBindings.length,a=this.samplerBindings.length;return i.push({firstUniformBuffer:r,numUniformBuffers:o,firstSampler:n,numSamplers:a}),r+=o,n+=a,{numUniformBuffers:r,numSamplers:n,bindingLayoutTables:i}},t}(kn);function Ye(e){return typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext?!0:!!(e&&e._version===2)}function fx(e){var t=si(e);switch(t){case de.BC1:case de.BC2:case de.BC3:case de.BC4_UNORM:case de.BC4_SNORM:case de.BC5_UNORM:case de.BC5_SNORM:return!0;default:return!1}}function hx(e){var t=ka(e);if(t&$e.Normalized)return!1;var r=si(e);return r===de.S8||r===de.S16||r===de.S32||r===de.U8||r===de.U16||r===de.U32}function lK(e){switch(e){case qn.STATIC:return w.STATIC_DRAW;case qn.DYNAMIC:return w.DYNAMIC_DRAW}}function D1(e){if(e&Wt.INDEX)return w.ELEMENT_ARRAY_BUFFER;if(e&Wt.VERTEX)return w.ARRAY_BUFFER;if(e&Wt.UNIFORM)return w.UNIFORM_BUFFER}function cK(e){switch(e){case gr.TRIANGLES:return w.TRIANGLES;case gr.POINTS:return w.POINTS;case gr.TRIANGLE_STRIP:return w.TRIANGLE_STRIP;case gr.LINES:return w.LINES;case gr.LINE_STRIP:return w.LINE_STRIP;default:throw new Error("Unknown primitive topology mode")}}function fK(e){switch(e){case de.U8:return w.UNSIGNED_BYTE;case de.U16:return w.UNSIGNED_SHORT;case de.U32:return w.UNSIGNED_INT;case de.S8:return w.BYTE;case de.S16:return w.SHORT;case de.S32:return w.INT;case de.F16:return w.HALF_FLOAT;case de.F32:return w.FLOAT;default:throw new Error("whoops")}}function hK(e){switch(e){case We.R:return 1;case We.RG:return 2;case We.RGB:return 3;case We.RGBA:return 4;default:return 1}}function dK(e){var t=si(e),r=a_(e),n=ka(e),i=fK(t),o=hK(r),a=!!(n&$e.Normalized);return{size:o,type:i,normalized:a}}function pK(e){switch(e){case X.U8_R:return w.UNSIGNED_BYTE;case X.U16_R:return w.UNSIGNED_SHORT;case X.U32_R:return w.UNSIGNED_INT;default:throw new Error("whoops")}}function js(e){switch(e){case tn.CLAMP_TO_EDGE:return w.CLAMP_TO_EDGE;case tn.REPEAT:return w.REPEAT;case tn.MIRRORED_REPEAT:return w.MIRRORED_REPEAT;default:throw new Error("whoops")}}function zl(e,t){if(t===Or.LINEAR&&e===lr.BILINEAR)return w.LINEAR_MIPMAP_LINEAR;if(t===Or.LINEAR&&e===lr.POINT)return w.NEAREST_MIPMAP_LINEAR;if(t===Or.NEAREST&&e===lr.BILINEAR)return w.LINEAR_MIPMAP_NEAREST;if(t===Or.NEAREST&&e===lr.POINT)return w.NEAREST_MIPMAP_NEAREST;if(t===Or.NO_MIP&&e===lr.BILINEAR)return w.LINEAR;if(t===Or.NO_MIP&&e===lr.POINT)return w.NEAREST;throw new Error("Unknown texture filter mode")}function Na(e,t){t===void 0&&(t=0);var r=e;return r.gl_buffer_pages[t/r.pageByteSize|0]}function ga(e){var t=e;return t.gl_texture}function ap(e){var t=e;return t.gl_sampler}function Xs(e,t){e.name=t,e.__SPECTOR_Metadata={name:t}}function U1(e,t){for(var r=[];;){var n=t.exec(e);if(!n)break;r.push(n)}return r}function Di(e){return e.blendMode==wr.ADD&&e.blendSrcFactor==xt.ONE&&e.blendDstFactor===xt.ZERO}function _K(e){switch(e){case Uc.OcclusionConservative:return w.ANY_SAMPLES_PASSED_CONSERVATIVE;default:throw new Error("whoops")}}function vK(e){if(e===bt.TEXTURE_2D)return w.TEXTURE_2D;if(e===bt.TEXTURE_2D_ARRAY)return w.TEXTURE_2D_ARRAY;if(e===bt.TEXTURE_CUBE_MAP)return w.TEXTURE_CUBE_MAP;if(e===bt.TEXTURE_3D)return w.TEXTURE_3D;throw new Error("whoops")}function rd(e,t,r,n){return!(e%r!==0||t%n!==0)}var mK=function(e){sr
  4491. Creation stack: `,this.creationStacks.get(t),`
  4492. Deletion stack: `,this.deletionStacks.get(t),`
  4493. This stack: `,new Error().stack),this.deletionStacks.set(t,new Error().stack),this.liveObjects.delete(t)},e.prototype.checkForLeaks=function(){var t,r;try{for(var n=Oo(this.liveObjects.values()),i=n.next();!i.done;i=n.next()){var o=i.value;console.warn("Object leaked:",o,"Creation stack:",this.creationStacks.get(o))}}catch(a){t={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},e.prototype.setResourceLeakCheck=function(t,r){r?this.liveObjects.add(t):this.liveObjects.delete(t)},e}(),RK=function(e){sr(t,e);function t(r){var n=r.id,i=r.device,o=r.descriptor,a,s,u=e.call(this,{id:n,device:i})||this;u.type=Lt.Sampler;var l=u.device.gl;if(Ye(l)){var f=u.device.ensureResourceExists(l.createSampler());l.samplerParameteri(f,w.TEXTURE_WRAP_S,js(o.addressModeU)),l.samplerParameteri(f,w.TEXTURE_WRAP_T,js(o.addressModeV)),l.samplerParameteri(f,w.TEXTURE_WRAP_R,js((a=o.addressModeW)!==null&&a!==void 0?a:o.addressModeU)),l.samplerParameteri(f,w.TEXTURE_MIN_FILTER,zl(o.minFilter,o.mipmapFilter)),l.samplerParameteri(f,w.TEXTURE_MAG_FILTER,zl(o.magFilter,Or.NO_MIP)),o.lodMinClamp!==void 0&&l.samplerParameterf(f,w.TEXTURE_MIN_LOD,o.lodMinClamp),o.lodMaxClamp!==void 0&&l.samplerParameterf(f,w.TEXTURE_MAX_LOD,o.lodMaxClamp),o.compareFunction!==void 0&&(l.samplerParameteri(f,l.TEXTURE_COMPARE_MODE,l.COMPARE_REF_TO_TEXTURE),l.samplerParameteri(f,l.TEXTURE_COMPARE_FUNC,o.compareFunction));var c=(s=o.maxAnisotropy)!==null&&s!==void 0?s:1;c>1&&u.device.EXT_texture_filter_anisotropic!==null&&(ht(o.minFilter===lr.BILINEAR&&o.magFilter===lr.BILINEAR&&o.mipmapFilter===Or.LINEAR),l.samplerParameterf(f,u.device.EXT_texture_filter_anisotropic.TEXTURE_MAX_ANISOTROPY_EXT,c)),u.gl_sampler=f}else u.descriptor=o;return u}return t.prototype.setTextureParameters=function(r,n,i){var o,a=this.device.gl,s=this.descriptor;this.isNPOT(n,i)?a.texParameteri(w.TEXTURE_2D,w.TEXTURE_MIN_FILTER,w.LINEAR):a.texParameteri(r,w.TEXTURE_MIN_FILTER,zl(s.minFilter,s.mipmapFilter)),a.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_S,js(s.addressModeU)),a.texParameteri(w.TEXTURE_2D,w.TEXTURE_WRAP_T,js(s.addressModeV)),a.texParameteri(r,w.TEXTURE_MAG_FILTER,zl(s.magFilter,Or.NO_MIP));var u=(o=s.maxAnisotropy)!==null&&o!==void 0?o:1;u>1&&this.device.EXT_texture_filter_anisotropic!==null&&(ht(s.minFilter===lr.BILINEAR&&s.magFilter===lr.BILINEAR&&s.mipmapFilter===Or.LINEAR),a.texParameteri(r,this.device.EXT_texture_filter_anisotropic.TEXTURE_MAX_ANISOTROPY_EXT,u))},t.prototype.destroy=function(){e.prototype.destroy.call(this),Ye(this.device.gl)&&this.device.gl.deleteSampler(ap(this))},t.prototype.isNPOT=function(r,n){return!kc(r)||!kc(n)},t}(kn),CK=function(){function e(){}return e.prototype.dispatchWorkgroups=function(t,r,n){},e.prototype.dispatchWorkgroupsIndirect=function(t,r){},e.prototype.setPipeline=function(t){},e.prototype.setBindings=function(t){},e.prototype.pushDebugGroup=function(t){},e.prototype.popDebugGroup=function(){},e.prototype.insertDebugMarker=function(t){},e}(),OK=function(e){sr(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r.type=Lt.RenderBundle,r.commands=[],r}return t.prototype.push=function(r){this.commands.push(r)},t.prototype.replay=function(){this.commands.forEach(function(r){return r()})},t}(kn),k1=65536,IK=/uniform(?:\s+)(\w+)(?:\s?){([^]*?)}/g,MK=function(){function e(t,r){r===void 0&&(r={}),this.shaderDebug=!1,this.OES_vertex_array_object=null,this.ANGLE_instanced_arrays=null,this.OES_texture_float=null,this.OES_draw_buffers_indexed=null,this.WEBGL_draw_buffers=null,this.WEBGL_depth_texture=null,this.WEBGL_color_buffer_float=null,this.EXT_color_buffer_half_float=null,this.WEBGL_compressed_texture_s3tc=null,this.WEBGL_compressed_texture_s3tc_srgb=null,this.EXT_texture_compression_rgtc=null,this.EXT_texture_filter_anisotropic=null,this.KHR_parallel_shader_compile=null,this.EXT_texture_norm16=null,this.EXT_color_buffer_float=null,this.OES_texture_float_linear=null,this.OES_texture_half_float_linear=null,this.scTexture=null,this.scPlatformFramebuffer=null,this.currentActiveTexture=null,this.currentB
  4494. out vec2 v_TexCoord;
  4495. void main() {
  4496. v_TexCoord = 0.5 * (a_Position + 1.0);
  4497. gl_Position = vec4(a_Position, 0., 1.);
  4498. #ifdef VIEWPORT_ORIGIN_TL
  4499. v_TexCoord.y = 1.0 - v_TexCoord.y;
  4500. #endif
  4501. }`},fragment:{glsl:`uniform sampler2D u_Texture;
  4502. in vec2 v_TexCoord;
  4503. out vec4 outputColor;
  4504. void main() {
  4505. outputColor = texture(SAMPLER_2D(u_Texture), v_TexCoord);
  4506. }`}}),this.blitVertexBuffer=this.createBuffer({usage:Wt.VERTEX|Wt.COPY_DST,viewOrSize:new Float32Array([-4,-4,4,-4,0,4])}),this.blitInputLayout=this.createInputLayout({vertexBufferDescriptors:[{arrayStride:4*2,stepMode:Io.VERTEX,attributes:[{format:X.F32_RG,offset:4*0,shaderLocation:0}]}],indexBufferFormat:null,program:this.blitProgram}),this.blitRenderPipeline=this.createRenderPipeline({topology:gr.TRIANGLES,sampleCount:1,program:this.blitProgram,colorAttachmentFormats:[X.U8_RGBA_RT],depthStencilAttachmentFormat:null,inputLayout:this.blitInputLayout,megaStateDescriptor:$a(za)}),this.blitBindings=this.createBindings({samplerBindings:[{sampler:null,texture:t.texture}],uniformBufferBindings:[]}),this.blitProgram.setUniformsLegacy({u_Texture:t}));var n=this.currentRenderPassDescriptor;this.currentRenderPassDescriptor=null,this.inBlitRenderPass=!0;var i=this.createRenderPass({colorAttachment:[t],colorResolveTo:[r],colorClearColor:[Oq]}),o=this.getCanvas(),a=o.width,s=o.height;i.setPipeline(this.blitRenderPipeline),i.setBindings(this.blitBindings),i.setVertexInput(this.blitInputLayout,[{buffer:this.blitVertexBuffer}],null),i.setViewport(0,0,a,s),this.gl.disable(this.gl.BLEND),i.draw(3,0),this.gl.enable(this.gl.BLEND),this.currentRenderPassDescriptor=n,this.inBlitRenderPass=!1},e}(),NK=function(){function e(t){this.pluginOptions=t}return e.prototype.createSwapChain=function(t){return Ia(this,void 0,void 0,function(){var r,n,i,o,a,s,u,l,f,c,h,d,p;return Ma(this,function(v){return r=this.pluginOptions,n=r.targets,i=r.xrCompatible,o=r.antialias,a=o===void 0?!1:o,s=r.preserveDrawingBuffer,u=s===void 0?!1:s,l=r.premultipliedAlpha,f=l===void 0?!0:l,c=r.shaderDebug,h=r.trackResources,d={antialias:a,preserveDrawingBuffer:u,stencil:!0,premultipliedAlpha:f,xrCompatible:i},this.handleContextEvents(t),n.includes("webgl2")&&(p=t.getContext("webgl2",d)||t.getContext("experimental-webgl2",d)),!p&&n.includes("webgl1")&&(p=t.getContext("webgl",d)||t.getContext("experimental-webgl",d)),[2,new MK(p,{shaderDebug:c,trackResources:h})]})})},e.prototype.handleContextEvents=function(t){var r=this.pluginOptions,n=r.onContextLost,i=r.onContextRestored,o=r.onContextCreationError;o&&t.addEventListener("webglcontextcreationerror",o,!1),n&&t.addEventListener("webglcontextlost",n,!1),i&&t.addEventListener("webglcontextrestored",i,!1)},e}();let ir;const dx=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&dx.decode();let ru=null;function rc(){return(ru===null||ru.byteLength===0)&&(ru=new Uint8Array(ir.memory.buffer)),ru}function Hc(e,t){return e=e>>>0,dx.decode(rc().subarray(e,e+t))}const mi=new Array(128).fill(void 0);mi.push(void 0,null,!0,!1);let lu=mi.length;function PK(e){lu===mi.length&&mi.push(mi.length+1);const t=lu;return lu=mi[t],mi[t]=e,t}function nc(e){return mi[e]}function LK(e){e<132||(mi[e]=lu,lu=e)}function wK(e){const t=nc(e);return LK(e),t}let Ha=0;const ic=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},FK=typeof ic.encodeInto=="function"?function(e,t){return ic.encodeInto(e,t)}:function(e,t){const r=ic.encode(e);return t.set(r),{read:e.length,written:r.length}};function jc(e,t,r){if(r===void 0){const s=ic.encode(e),u=t(s.length,1)>>>0;return rc().subarray(u,u+s.length).set(s),Ha=s.length,u}let n=e.length,i=t(n,1)>>>0;const o=rc();let a=0;for(;a<n;a++){const s=e.charCodeAt(a);if(s>127)break;o[i+a]=s}if(a!==n){a!==0&&(e=e.slice(a)),i=r(i,n,n=a+e.length*3,1)>>>0;const s=rc().subarray(i+a,i+n),u=FK(e,s);a+=u.written}return Ha=a,i}let nu=null;function Xc(){return(nu===null||nu.byteLength===0)&&(nu=new Int32Array(ir.memory.buffer)),nu}function BK(e,t,r){let n,i;try{const s=ir.__wbindgen_add_to_stack_pointer(-16),u=jc(e,ir.__wbindgen_malloc,ir.__wbindgen_realloc),l=Ha,f=jc(t,ir.__wbindgen_malloc,ir.__wbindgen_realloc),c=Ha;ir.glsl_compile(s,u,l,f,c,r);var o=Xc()[s/4+0],a=Xc()[s/4+1];return n=o,i=a,Hc(o,a)}finally{ir.__wbindgen_add_to_stack_pointer(16),ir.__wbindgen_free(n,i,1)}}class Ou{st
  4507. `;function o(_){return typeof atob<"u"?atob(_):"base64:"+_}function a(_){var b=new Error("(regl) "+_);throw console.error(b),b}function s(_,b){_||a(b)}function u(_){return _?": "+_:""}function l(_,b,D){_ in b||a("unknown parameter ("+_+")"+u(D)+". possible values: "+Object.keys(b).join())}function f(_,b){r(_)||a("invalid parameter type"+u(b)+". must be a typed array")}function c(_,b){switch(b){case"number":return typeof _=="number";case"object":return typeof _=="object";case"string":return typeof _=="string";case"boolean":return typeof _=="boolean";case"function":return typeof _=="function";case"undefined":return typeof _>"u";case"symbol":return typeof _=="symbol"}}function h(_,b,D){c(_,b)||a("invalid parameter type"+u(D)+". expected "+b+", got "+typeof _)}function d(_,b){_>=0&&(_|0)===_||a("invalid parameter type, ("+_+")"+u(b)+". must be a nonnegative integer")}function p(_,b,D){b.indexOf(_)<0&&a("invalid value"+u(D)+". must be one of: "+b)}var v=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"];function g(_){Object.keys(_).forEach(function(b){v.indexOf(b)<0&&a('invalid regl constructor argument "'+b+'". must be one of '+v)})}function y(_,b){for(_=_+"";_.length<b;)_=" "+_;return _}function S(){this.name="unknown",this.lines=[],this.index={},this.hasErrors=!1}function R(_,b){this.number=_,this.line=b,this.errors=[]}function x(_,b,D){this.file=_,this.line=b,this.message=D}function M(){var _=new Error,b=(_.stack||_).toString(),D=/compileProcedure.*\n\s*at.*\((.*)\)/.exec(b);if(D)return D[1];var te=/compileProcedure.*\n\s*at\s+(.*)(\n|$)/.exec(b);return te?te[1]:"unknown"}function $(){var _=new Error,b=(_.stack||_).toString(),D=/at REGLCommand.*\n\s+at.*\((.*)\)/.exec(b);if(D)return D[1];var te=/at REGLCommand.*\n\s+at\s+(.*)\n/.exec(b);return te?te[1]:"unknown"}function F(_,b){var D=_.split(`
  4508. `),te=1,fe=0,re={unknown:new S,0:new S};re.unknown.name=re[0].name=b||M(),re.unknown.lines.push(new R(0,""));for(var ae=0;ae<D.length;++ae){var xe=D[ae],Re=/^\s*#\s*(\w+)\s+(.+)\s*$/.exec(xe);if(Re)switch(Re[1]){case"line":var we=/(\d+)(\s+\d+)?/.exec(Re[2]);we&&(te=we[1]|0,we[2]&&(fe=we[2]|0,fe in re||(re[fe]=new S)));break;case"define":var Ie=/SHADER_NAME(_B64)?\s+(.*)$/.exec(Re[2]);Ie&&(re[fe].name=Ie[1]?o(Ie[2]):Ie[2]);break}re[fe].lines.push(new R(te++,xe))}return Object.keys(re).forEach(function(Me){var Fe=re[Me];Fe.lines.forEach(function(Te){Fe.index[Te.number]=Te})}),re}function Y(_){var b=[];return _.split(`
  4509. `).forEach(function(D){if(!(D.length<5)){var te=/^ERROR:\s+(\d+):(\d+):\s*(.*)$/.exec(D);te?b.push(new x(te[1]|0,te[2]|0,te[3].trim())):D.length>0&&b.push(new x("unknown",0,D))}}),b}function ge(_,b){b.forEach(function(D){var te=_[D.file];if(te){var fe=te.index[D.line];if(fe){fe.errors.push(D),te.hasErrors=!0;return}}_.unknown.hasErrors=!0,_.unknown.lines[0].errors.push(D)})}function q(_,b,D,te,fe){if(!_.getShaderParameter(b,_.COMPILE_STATUS)){var re=_.getShaderInfoLog(b),ae=te===_.FRAGMENT_SHADER?"fragment":"vertex";Je(D,"string",ae+" shader source must be a string",fe);var xe=F(D,fe),Re=Y(re);ge(xe,Re),Object.keys(xe).forEach(function(we){var Ie=xe[we];if(!Ie.hasErrors)return;var Me=[""],Fe=[""];function Te(Ne,Z){Me.push(Ne),Fe.push(Z||"")}Te("file number "+we+": "+Ie.name+`
  4510. `,"color:red;text-decoration:underline;font-weight:bold"),Ie.lines.forEach(function(Ne){if(Ne.errors.length>0){Te(y(Ne.number,4)+"| ","background-color:yellow; font-weight:bold"),Te(Ne.line+i,"color:red; background-color:yellow; font-weight:bold");var Z=0;Ne.errors.forEach(function(oe){var be=oe.message,De=/^\s*'(.*)'\s*:\s*(.*)$/.exec(be);if(De){var me=De[1];switch(be=De[2],me){case"assign":me="=";break}Z=Math.max(Ne.line.indexOf(me,Z),0)}else Z=0;Te(y("| ",6)),Te(y("^^^",Z+3)+i,"font-weight:bold"),Te(y("| ",6)),Te(be+i,"font-weight:bold")}),Te(y("| ",6)+i)}else Te(y(Ne.number,4)+"| "),Te(Ne.line+i,"color:red")}),typeof document<"u"&&!window.chrome?(Fe[0]=Me.join("%c"),console.log.apply(console,Fe)):console.log(Me.join(""))}),s.raise("Error compiling "+ae+" shader, "+xe[0].name)}}function k(_,b,D,te,fe){if(!_.getProgramParameter(b,_.LINK_STATUS)){var re=_.getProgramInfoLog(b),ae=F(D,fe),xe=F(te,fe),Re='Error linking program with vertex shader, "'+xe[0].name+'", and fragment shader "'+ae[0].name+'"';typeof document<"u"?console.log("%c"+Re+i+"%c"+re,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(Re+i+re),s.raise(Re)}}function G(_){_._commandRef=M()}function K(_,b,D,te){G(_);function fe(Re){return Re?te.id(Re):0}_._fragId=fe(_.static.frag),_._vertId=fe(_.static.vert);function re(Re,we){Object.keys(we).forEach(function(Ie){Re[te.id(Ie)]=!0})}var ae=_._uniformSet={};re(ae,b.static),re(ae,b.dynamic);var xe=_._attributeSet={};re(xe,D.static),re(xe,D.dynamic),_._hasCount="count"in _.static||"count"in _.dynamic||"elements"in _.static||"elements"in _.dynamic}function ce(_,b){var D=$();a(_+" in command "+(b||M())+(D==="unknown"?"":" called from "+D))}function Pe(_,b,D){_||ce(b,D||M())}function Xe(_,b,D,te){_ in b||ce("unknown parameter ("+_+")"+u(D)+". possible values: "+Object.keys(b).join(),te||M())}function Je(_,b,D,te){c(_,b)||ce("invalid parameter type"+u(D)+". expected "+b+", got "+typeof _,te||M())}function ft(_){_()}function Ge(_,b,D){_.texture?p(_.texture._texture.internalformat,b,"unsupported texture format for attachment"):p(_.renderbuffer._renderbuffer.format,D,"unsupported renderbuffer format for attachment")}var et=33071,vt=9728,mt=9984,It=9985,wt=9986,gt=9987,xr=5120,Gt=5121,Xr=5122,le=5123,ze=5124,nt=5125,Ae=5126,Dt=32819,Et=32820,zt=33635,Rt=34042,ut=36193,Ut={};Ut[xr]=Ut[Gt]=1,Ut[Xr]=Ut[le]=Ut[ut]=Ut[zt]=Ut[Dt]=Ut[Et]=2,Ut[ze]=Ut[nt]=Ut[Ae]=Ut[Rt]=4;function $r(_,b){return _===Et||_===Dt||_===zt?2:_===Rt?4:Ut[_]*b}function dr(_){return!(_&_-1)&&!!_}function Jt(_,b,D){var te,fe=b.width,re=b.height,ae=b.channels;s(fe>0&&fe<=D.maxTextureSize&&re>0&&re<=D.maxTextureSize,"invalid texture shape"),(_.wrapS!==et||_.wrapT!==et)&&s(dr(fe)&&dr(re),"incompatible wrap mode for texture, both width and height must be power of 2"),b.mipmask===1?fe!==1&&re!==1&&s(_.minFilter!==mt&&_.minFilter!==wt&&_.minFilter!==It&&_.minFilter!==gt,"min filter requires mipmap"):(s(dr(fe)&&dr(re),"texture must be a square power of 2 to support mipmapping"),s(b.mipmask===(fe<<1)-1,"missing or incomplete mipmap data")),b.type===Ae&&(D.extensions.indexOf("oes_texture_float_linear")<0&&s(_.minFilter===vt&&_.magFilter===vt,"filter not supported, must enable oes_texture_float_linear"),s(!_.genMipmaps,"mipmap generation not supported with float textures"));var xe=b.images;for(te=0;te<16;++te)if(xe[te]){var Re=fe>>te,we=re>>te;s(b.mipmask&1<<te,"missing mipmap data");var Ie=xe[te];if(s(Ie.width===Re&&Ie.height===we,"invalid shape for mip images"),s(Ie.format===b.format&&Ie.internalformat===b.internalformat&&Ie.type===b.type,"incompatible type for mip image"),!Ie.compressed)if(Ie.data){var Me=Math.ceil($r(Ie.type,ae)*Re/Ie.unpackAlignment)*Ie.unpackAlignment;s(Ie.data.byteLength===Me*we,"invalid data for image, buffer size is inconsistent with image format")}else Ie.element||Ie.copy}else _.genMipmaps||s((b.mipmask&1<<te)===0,"extra mipmap data");b.compressed&&s(!_.genMipmaps,"mipmap generation for compressed images not supported")}function nn(_,b,D,te){var fe=_.width,re=_.height,ae=_.channels;s(fe>0&&fe<=te.maxTextureSi
  4511. `).replace(/}/g,`}
  4512. `).replace(/{/g,`{
  4513. `),Te=Function.apply(null,b.concat(Fe));return Te.apply(null,D)}return{global:xe,link:te,block:fe,proc:we,scope:re,cond:ae,compile:Ie}}var ea="xyzw".split(""),hv=5121,ta=1,th=2,dv=0,pv=1,_v=2,vv=3,rh=4,mv="dither",gv="blend.enable",Ev="blend.color",nh="blend.equation",ih="blend.func",yv="depth.enable",Tv="depth.func",Av="depth.range",Sv="depth.mask",oh="colorMask",xv="cull.enable",bv="cull.face",ah="frontFace",sh="lineWidth",Rv="polygonOffset.enable",uh="polygonOffset.offset",Cv="sample.alpha",Ov="sample.enable",lh="sample.coverage",Iv="stencil.enable",Mv="stencil.mask",ch="stencil.func",fh="stencil.opFront",hs="stencil.opBack",Nv="scissor.enable",hl="scissor.box",hi="viewport",ds="profile",ao="framebuffer",ps="vert",_s="frag",so="elements",uo="primitive",lo="count",dl="offset",pl="instances",vs="vao",hh="Width",dh="Height",ra=ao+hh,na=ao+dh,Jb=hi+hh,eR=hi+dh,Pv="drawingBuffer",Lv=Pv+hh,wv=Pv+dh,tR=[ih,nh,ch,fh,hs,lh,hi,hl,uh],ia=34962,rR=34963,nR=35632,iR=35633,Fv=3553,oR=34067,aR=2884,sR=3042,uR=3024,lR=2960,cR=2929,fR=3089,hR=32823,dR=32926,pR=32928,ph=5126,_l=35664,vl=35665,ml=35666,_h=5124,gl=35667,El=35668,yl=35669,vh=35670,Tl=35671,Al=35672,Sl=35673,ms=35674,gs=35675,Es=35676,ys=35678,Ts=35680,Bv=4,As=1028,co=1029,Dv=2304,mh=2305,_R=32775,vR=32776,mR=519,Mi=7680,Uv=0,kv=1,$v=32774,gR=513,zv=36160,ER=36064,ti={0:0,1:1,zero:0,one:1,"src color":768,"one minus src color":769,"src alpha":770,"one minus src alpha":771,"dst color":774,"one minus dst color":775,"dst alpha":772,"one minus dst alpha":773,"constant color":32769,"one minus constant color":32770,"constant alpha":32771,"one minus constant alpha":32772,"src alpha saturate":776},Vv=["constant color, constant alpha","one minus constant color, constant alpha","constant color, one minus constant alpha","one minus constant color, one minus constant alpha","constant alpha, constant color","constant alpha, one minus constant color","one minus constant alpha, constant color","one minus constant alpha, one minus constant color"],oa={never:512,less:513,"<":513,equal:514,"=":514,"==":514,"===":514,lequal:515,"<=":515,greater:516,">":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},Ni={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},Hv={frag:nR,vert:iR},gh={cw:Dv,ccw:mh};function xl(_){return Array.isArray(_)||r(_)||A(_)}function jv(_){return _.sort(function(b,D){return b===hi?-1:D===hi?1:b<D?-1:1})}function mn(_,b,D,te){this.thisDep=_,this.contextDep=b,this.propDep=D,this.append=te}function Pi(_){return _&&!(_.thisDep||_.contextDep||_.propDep)}function pr(_){return new mn(!1,!1,!1,_)}function sn(_,b){var D=_.type;if(D===dv){var te=_.data.length;return new mn(!0,te>=1,te>=2,b)}else if(D===rh){var fe=_.data;return new mn(fe.thisDep,fe.contextDep,fe.propDep,b)}else return new mn(D===vv,D===_v,D===pv,b)}var Xv=new mn(!1,!1,!1,function(){});function yR(_,b,D,te,fe,re,ae,xe,Re,we,Ie,Me,Fe,Te,Ne){var Z=we.Record,oe={add:32774,subtract:32778,"reverse subtract":32779};D.ext_blend_minmax&&(oe.min=_R,oe.max=vR);var be=D.angle_instanced_arrays,De=D.webgl_draw_buffers,me={dirty:!0,profile:Ne.profile},Ve={},Ce=[],ke={},Ee={};function Be(T){return T.replace(".","_")}function tt(T,I,B){var J=Be(T);Ce.push(T),Ve[J]=me[J]=!!B,ke[J]=I}function at(T,I,B){var J=Be(T);Ce.push(T),Array.isArray(B)?(me[J]=B.slice(),Ve[J]=B.slice()):me[J]=Ve[J]=B,Ee[J]=I}tt(mv,uR),tt(gv,sR),at(Ev,"blendColor",[0,0,0,0]),at(nh,"blendEquationSeparate",[$v,$v]),at(ih,"blendFuncSeparate",[kv,Uv,kv,Uv]),tt(yv,cR,!0),at(Tv,"depthFunc",gR),at(Av,"depthRange",[0,1]),at(Sv,"depthMask",!0),at(oh,oh,[!0,!0,!0,!0]),tt(xv,aR),at(bv,"cullFace",co),at(ah,ah,mh),at(sh,sh,1),tt(Rv,hR),at(uh,"polygonOffset",[0,0]),tt(Cv,dR),tt(Ov,pR),at(lh,"sampleCoverage",[1,!1]),tt(Iv,lR),at(Mv,"stencilMask",-1),at(ch,"stencilFunc",[mR,0,-1]),at(fh,"stencilOpSeparate",[As,Mi,Mi,Mi]),at(hs,"stencilOpSeparate",[co,Mi,Mi,Mi]),tt(Nv,fR),at(hl,"scissor",[0,0,_.drawingBufferWidth,_.drawingBufferHeight]),at(hi,hi,[0,0,_.drawingBufferWidth,_.drawingBufferHeight]